Skip to content

Commit

Permalink
fix(pci-workflow): execution date format
Browse files Browse the repository at this point in the history
ref: DTCORE-2746
Signed-off-by: Florian Renaut <[email protected]>
  • Loading branch information
frenautvh committed Oct 10, 2024
1 parent 3eb3105 commit 213d2d8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ describe('useExecutions tests', () => {
state: 'SUCCESS',
executedAt: '2024-07-18T01:05:29Z',
executedAtDate: '18 juillet. 2024',
executedAtTime: format(parseISO('2024-07-18T01:05:29Z'), 'hh:mm:ss'),
executedAtTime: format(parseISO('2024-07-18T01:05:29'), 'hh:mm:ss'),
},
{
id: 'project_id_2',
state: 'SUCCESS',
executedAt: '2024-07-17T01:05:24Z',
executedAtDate: '17 juillet. 2024',
executedAtTime: format(parseISO('2024-07-17T01:05:24Z'), 'hh:mm:ss'),
executedAtTime: format(parseISO('2024-07-17T01:05:24'), 'hh:mm:ss'),
},
]);
});
Expand Down
22 changes: 16 additions & 6 deletions packages/manager/apps/pci-workflow/src/api/hooks/useExecutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,22 @@ export const useWorkflowExecutions = (
if (Array.isArray(executions) && executions.length > 0) {
mappedExecution = executions.map((exec) => ({
...exec,
executedAtDate: format(parseISO(exec.executedAt), "dd MMMM'.' yyyy", {
locale: locales[userLocale],
}),
executedAtTime: format(parseISO(exec.executedAt), 'hh:mm:ss', {
locale: locales[userLocale],
}),
executedAtDate: format(
// remove Z timezone to treat as UTC date
parseISO(exec.executedAt?.replace(/Z$/, '')),
"dd MMMM'.' yyyy",
{
locale: locales[userLocale],
},
),
executedAtTime: format(
// remove Z timezone to treat as UTC date
parseISO(exec.executedAt?.replace(/Z$/, '')),
'hh:mm:ss',
{
locale: locales[userLocale],
},
),
}));
}

Expand Down

0 comments on commit 213d2d8

Please sign in to comment.