diff --git a/Keas.Mvc/ClientApp/src/components/History/HistoryListItem.tsx b/Keas.Mvc/ClientApp/src/components/History/HistoryListItem.tsx index 31e4d4a30..88c517dab 100644 --- a/Keas.Mvc/ClientApp/src/components/History/HistoryListItem.tsx +++ b/Keas.Mvc/ClientApp/src/components/History/HistoryListItem.tsx @@ -5,28 +5,29 @@ import { useContext } from 'react'; import { Context } from '../../Context'; interface IProps { - history: IHistory; - showLink?: boolean; + history: IHistory; + showLink?: boolean; } const HistoryListItem = (props: IProps) => { - const context = useContext(Context); + const context = useContext(Context); return ( - {DateUtil.formatExpiration(props.history.actedDate)} - {props.history.description} - - {props.showLink && props.history.link != null &&( - ... - )} - + {DateUtil.formatDateFromUtc(props.history.actedDate)} + {props.history.description} + + {props.showLink && props.history.link != null && ( + + ... + + )} + ); }; - export default HistoryListItem; diff --git a/Keas.Mvc/ClientApp/src/util/dates.ts b/Keas.Mvc/ClientApp/src/util/dates.ts index 8e60666c3..842604dd0 100644 --- a/Keas.Mvc/ClientApp/src/util/dates.ts +++ b/Keas.Mvc/ClientApp/src/util/dates.ts @@ -10,6 +10,24 @@ export class DateUtil { return format(new Date(date), 'MM/dd/yyyy'); } + public static formatDateFromUtc(date: Date): string { + if (date === null) { + return ''; + } + + let str = date.toString(); + if (!str.endsWith('Z')) { + str += 'Z'; + } + + return format( + new Date(str).toLocaleString('en-US', { + timeZone: 'America/Los_Angeles' + }), + 'MM/dd/yyyy' + ); + } + public static formatExpiration(expiration: Date): string { if (expiration === null) { return '';