Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

fix issue topcoder-platform/taas-apis#507 #501

Merged
merged 2 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/routes/JobForm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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(
() => {
Expand Down
8 changes: 7 additions & 1 deletion src/services/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import {
axiosInstance as axios,
fetchCustom as fetch,
} from "./requestInterceptor";

import _ from "lodash";
import moment from "moment";
import config from "../../config";

/**
Expand Down Expand Up @@ -257,6 +258,11 @@ export const searchRoles = (searchObject) => {
* @returns {Promise<object>} 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);
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ export const formatOpenPositions = (job, resources) => {
* @returns {string} formatted string
*/
export const formatJobDate = (startDate, duration) => {
const dateStr = startDate ? moment(startDate).format(DAY_FORMAT) : "";
const dateStr = startDate ? startDate : "";

if (startDate && duration) {
return `Requested starting ${dateStr} for ${formatPlural(
Expand Down