Skip to content

Commit

Permalink
NEOS-1248:add optional chaining to toDate() func to avoid "toDate() i…
Browse files Browse the repository at this point in the history
…s not a function" errors (#2696)
  • Loading branch information
evisdrenova authored Sep 17, 2024
1 parent 93d822f commit 4221c18
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function getColumns(
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('createdAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('createdAt')?.toDate())}
</span>
</div>
);
Expand All @@ -105,7 +105,7 @@ export function getColumns(
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('updatedAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('updatedAt')?.toDate())}
</span>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function JobNextRuns({ jobId, status }: Props): ReactElement {
<TableRow key={`${r}-${index}`}>
<TableCell className="py-3">
<span className="font-medium">
{formatDateTime(r.toDate())}
{formatDateTime(r?.toDate())}
</span>
</TableCell>
</TableRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function getColumns(props: GetJobsProps): ColumnDef<JobColumn>[] {
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('createdAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('createdAt')?.toDate())}
</span>
</div>
);
Expand All @@ -150,7 +150,7 @@ export function getColumns(props: GetJobsProps): ColumnDef<JobColumn>[] {
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('updatedAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('updatedAt')?.toDate())}
</span>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function getColumns(props: GetColumnsProps): ColumnDef<JobRunEvent>[] {
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{startTime && formatDateTimeMilliseconds(startTime.toDate())}
{startTime && formatDateTimeMilliseconds(startTime?.toDate())}
</span>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function RunEventSubTable(props: RunEventSubTableProps): React.ReactElement {
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{t.eventTime &&
formatDateTimeMilliseconds(t.eventTime.toDate())}
formatDateTimeMilliseconds(t.eventTime?.toDate())}
</span>
</div>
</TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function getColumns(
return (
<div>
<span className="font-medium">
{formatDateTime(row.getValue<Timestamp>('startedAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('startedAt')?.toDate())}
</span>
</div>
);
Expand All @@ -116,7 +116,7 @@ export function getColumns(
),
cell: ({ row }) => {
const completedAt = row.getValue('completedAt')
? formatDateTime(row.getValue<Timestamp>('completedAt').toDate())
? formatDateTime(row.getValue<Timestamp>('completedAt')?.toDate())
: undefined;
return (
<div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function getColumns(
cell: ({ row }) => {
const expiresAt = row
.getValue<Timestamp>('expiresAt')
.toDate()
?.toDate()
.getTime();
const text = expiresAt > Date.now() ? 'active' : 'expired';
const badgeVariant: BadgeProps['variant'] =
Expand All @@ -87,7 +87,7 @@ export function getColumns(
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('expiresAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('expiresAt')?.toDate())}
</span>
</div>
);
Expand All @@ -105,7 +105,7 @@ export function getColumns(
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('createdAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('createdAt')?.toDate())}
</span>
</div>
);
Expand All @@ -123,7 +123,7 @@ export function getColumns(
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('updatedAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('updatedAt')?.toDate())}
</span>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function getColumns(
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('createdAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('createdAt')?.toDate())}
</span>
</div>
);
Expand All @@ -74,7 +74,7 @@ function getColumns(
return (
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{formatDateTime(row.getValue<Timestamp>('expiresAt').toDate())}
{formatDateTime(row.getValue<Timestamp>('expiresAt')?.toDate())}
</span>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function getUserDefinedTransformerColumns(
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{row.original.createdAt &&
formatDateTime(row.getValue<Timestamp>('createdAt').toDate())}
formatDateTime(row.getValue<Timestamp>('createdAt')?.toDate())}
</span>
</div>
);
Expand All @@ -108,7 +108,7 @@ export function getUserDefinedTransformerColumns(
<div className="flex space-x-2">
<span className="max-w-[500px] truncate font-medium">
{row.original.updatedAt &&
formatDateTime(row.getValue<Timestamp>('updatedAt').toDate())}
formatDateTime(row.getValue<Timestamp>('updatedAt')?.toDate())}
</span>
</div>
);
Expand Down

0 comments on commit 4221c18

Please sign in to comment.