Make sure createdAt is properly formated

Co-authored-by: blam<ben@blam.sh>
Co-authored-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Johan Haals
2021-02-15 16:15:38 +01:00
parent fe08d59921
commit de09326959
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -56,6 +56,7 @@
"isomorphic-git": "^1.8.0",
"jsonschema": "^1.2.6",
"knex": "^0.21.6",
"luxon": "^1.26.0",
"morgan": "^1.10.0",
"uuid": "^8.2.0",
"winston": "^3.2.1",
@@ -32,6 +32,7 @@ import {
TaskStoreEmitOptions,
TaskStoreGetEventsOptions,
} from './types';
import { DateTime } from 'luxon';
const migrationsDir = resolvePackagePath(
'@backstage/plugin-scaffolder-backend',
@@ -259,7 +260,10 @@ export class DatabaseTaskStore implements TaskStore {
taskId,
body,
type: event.event_type,
createdAt: event.created_at,
createdAt:
typeof event.created_at === 'string'
? DateTime.fromSQL(event.created_at, { zone: 'UTC' }).toISO()
: event.created_at,
};
} catch (error) {
throw new Error(