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
31 changes: 16 additions & 15 deletions Keas.Mvc/ClientApp/src/components/History/HistoryListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<tr>
<td>{DateUtil.formatExpiration(props.history.actedDate)}</td>
<td>{props.history.description}</td>
<td>
{props.showLink && props.history.link != null &&(
<a
href={`/${context.team.slug}${props.history.link}`}
target='_blank'
rel='noopener noreferrer'
>...</a>
)}
</td>
<td>{DateUtil.formatDateFromUtc(props.history.actedDate)}</td>
<td>{props.history.description}</td>
<td>
{props.showLink && props.history.link != null && (
<a
href={`/${context.team.slug}${props.history.link}`}
target='_blank'
rel='noopener noreferrer'
>
...
</a>
)}
</td>
</tr>
);
};


export default HistoryListItem;
18 changes: 18 additions & 0 deletions Keas.Mvc/ClientApp/src/util/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
Expand Down