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

fix: issue #82 #93

Merged
merged 1 commit into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 2 deletions src/routes/MyTeamsDetails/components/TeamPositions/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SkillsList, { skillShape } from "components/SkillsList";
import Button from "components/Button";
import { POSITION_STATUS, POSITION_STATUS_TO_TEXT, RATE_TYPE } from "constants";
import "./styles.module.scss";
import { formatDateRange } from "utils/format";
import { formatJobDate } from "utils/format";
import { Link } from "@reach/router";

const TeamPositions = ({ teamId, positions }) => {
Expand Down Expand Up @@ -44,7 +44,7 @@ const TeamPositions = ({ teamId, positions }) => {
</div>
<div styleName="table-group-first-inner">
<div styleName="table-cell cell-date">
{formatDateRange(position.startDate, position.endDate)}
{formatJobDate(position.startDate, position.duration)}
</div>
<div styleName="table-cell cell-money">
{/* Hide rate as we don't have data for it */}
Expand Down
20 changes: 20 additions & 0 deletions src/utils/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,23 @@ export const formatPageTitle = (pageTitle) => {

return formattedPageTitle;
};

/**
* Format job date
*
* @param {string} startDate job startDate
* @param {number} duration job duration
*
* @returns {string} formatted string
*/
export const formatJobDate = (startDate, duration) => {
const dateStr = startDate ? moment(startDate).format(DAY_FORMAT) : "";
if (startDate && duration) {
return `Requested starting ${dateStr} for ${duration} weeks`;
} else if (startDate) {
return `Requested starting ${dateStr}`;
} else if (duration) {
return `${duration} weeks`;
}
return "";
};