diff --git a/src/routes/JobForm/index.jsx b/src/routes/JobForm/index.jsx index 8405d2c..00c0018 100644 --- a/src/routes/JobForm/index.jsx +++ b/src/routes/JobForm/index.jsx @@ -8,6 +8,7 @@ import React, { useState, useEffect } from "react"; import PT from "prop-types"; import { toastr } from "react-redux-toastr"; +import moment from 'moment'; import _ from "lodash"; import store from "../../store"; import Page from "components/Page"; @@ -33,6 +34,9 @@ const JobForm = ({ teamId, jobId }) => { const title = isEdit ? "Edit Job Details" : "Create Job"; const onSubmit = async (values) => { + if (values.startDate) { + values.startDate = moment(values.startDate).format('YYYY-MM-DD') + } if (isEdit) { await updateJob(values, jobId).then( () => { diff --git a/src/services/teams.js b/src/services/teams.js index 1e0ed86..984d9b4 100644 --- a/src/services/teams.js +++ b/src/services/teams.js @@ -5,7 +5,8 @@ import { axiosInstance as axios, fetchCustom as fetch, } from "./requestInterceptor"; - +import _ from "lodash"; +import moment from "moment"; import config from "../../config"; /** @@ -257,6 +258,11 @@ export const searchRoles = (searchObject) => { * @returns {Promise} object containing new projectId */ export const postTeamRequest = (teamObject) => { + _.forEach(teamObject.positions, (p) => { + if (p.startMonth) { + p.startMonth = moment(p.startMonth).format("YYYY-MM-DD"); + } + }); const url = `${config.API.V5}/taas-teams/submitTeamRequest`; return axios.post(url, teamObject); };