Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import TableCell from '@mui/material/TableCell';
import TableHead from '@mui/material/TableHead';
import TableRow from '@mui/material/TableRow';
import Typography from '@mui/material/Typography';
import moment from 'moment';
import classnames from 'classnames';
import Status from '../../common/Status';
import { useUser } from '../../../providers/UserProvider';
import { PrimaryButton, MuiIcon } from '../../common/';
import { axios, getAuthHeaderConfig } from '../../../utils';
import { formatPlanVersionDate } from '../../../utils/format/planVersionDate';
import * as API from '../../../constants/api';
import AttachmentsList from './AttachmentsList';
import { ATTACHMENT_TYPE } from '../../../constants/variables';
Expand Down Expand Up @@ -52,13 +52,9 @@ const VersionRow = ({ option, user }: { option: any; user: any }) => {
<TableRow hover>
<TableCell>{option.version.amendmentType}</TableCell>
<TableCell>{option.version.submittedBy}</TableCell>
<TableCell>
{option.version.createdAt ? moment(option.version.createdAt).format('MMM DD YYYY h:mm a') : ''}
</TableCell>
<TableCell>{formatPlanVersionDate(option.version.createdAt)}</TableCell>
<TableCell>{option.version.approvedBy}</TableCell>
<TableCell>
{option.version.approvedAt === null ? '' : moment(option.version.approvedAt).format('MMM DD YYYY h:mm a')}
</TableCell>
<TableCell>{formatPlanVersionDate(option.version.approvedAt)}</TableCell>
<TableCell>
<Status
className={classnames('versions_status_icon', {
Expand Down
11 changes: 11 additions & 0 deletions src/utils/format/planVersionDate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import timezone from 'dayjs/plugin/timezone';

dayjs.extend(utc);
dayjs.extend(timezone);

export const PLAN_TIMEZONE = 'America/Vancouver';

export const formatPlanVersionDate = (date: string | Date | null | undefined): string =>
date ? dayjs.utc(date).tz(PLAN_TIMEZONE).format('MMM DD YYYY h:mm a') : '';
Loading