update function to use local timezone and use original format

Signed-off-by: Rye Pasaporte <ryepassport@gmail.com>
This commit is contained in:
Rye Pasaporte
2025-02-28 12:52:45 +01:00
parent 9f74383f9c
commit 97abc96bb8
2 changed files with 3 additions and 5 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
'@backstage/plugin-catalog-unprocessed-entities': patch
---
Fixed the `convertTimeToLocalTimezone` function in the FailedEntities component to correctly parse ISO 8601 date strings.
Fixed the `convertTimeToLocalTimezone` function in the FailedEntities component to correctly parse ISO 8601 date strings and set the timezone to the current local timezone.
@@ -94,12 +94,10 @@ const RenderErrorContext = ({
*/
const convertTimeToLocalTimezone = (strDateTime: string | Date) => {
const dateTime = DateTime.fromISO(strDateTime.toLocaleString(), {
zone: 'UTC',
zone: DateTime.local().zoneName,
});
const dateTimeLocalTz = dateTime.setZone(DateTime.local().zoneName);
return dateTimeLocalTz.toFormat('yyyy-MM-dd hh:mm:ss ZZZZ');
return dateTime.toFormat('yyyy-MM-dd hh:mm:ss ZZZZ');
};
export const FailedEntities = () => {