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

Commit c627bf0

Browse files
committed
fix: issue #82
1 parent cbd5869 commit c627bf0

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/routes/MyTeamsDetails/components/TeamPositions/index.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SkillsList, { skillShape } from "components/SkillsList";
1010
import Button from "components/Button";
1111
import { POSITION_STATUS, POSITION_STATUS_TO_TEXT, RATE_TYPE } from "constants";
1212
import "./styles.module.scss";
13-
import { formatDateRange } from "utils/format";
13+
import { formatJobDate } from "utils/format";
1414
import { Link } from "@reach/router";
1515

1616
const TeamPositions = ({ teamId, positions }) => {
@@ -44,7 +44,7 @@ const TeamPositions = ({ teamId, positions }) => {
4444
</div>
4545
<div styleName="table-group-first-inner">
4646
<div styleName="table-cell cell-date">
47-
{formatDateRange(position.startDate, position.endDate)}
47+
{formatJobDate(position.startDate, position.duration)}
4848
</div>
4949
<div styleName="table-cell cell-money">
5050
{/* Hide rate as we don't have data for it */}

src/utils/format.js

+20
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,23 @@ export const formatPageTitle = (pageTitle) => {
200200

201201
return formattedPageTitle;
202202
};
203+
204+
/**
205+
* Format job date
206+
*
207+
* @param {string} startDate job startDate
208+
* @param {number} duration job duration
209+
*
210+
* @returns {string} formatted string
211+
*/
212+
export const formatJobDate = (startDate, duration) => {
213+
const dateStr = startDate ? moment(startDate).format(DAY_FORMAT) : "";
214+
if (startDate && duration) {
215+
return `Requested starting ${dateStr} for ${duration} weeks`;
216+
} else if (startDate) {
217+
return `Requested starting ${dateStr}`;
218+
} else if (duration) {
219+
return `${duration} weeks`;
220+
}
221+
return "";
222+
};

0 commit comments

Comments
 (0)