Skip to content

Commit

Permalink
fix: Fixed format of the createdAt field in "versioning" table (#274)
Browse files Browse the repository at this point in the history
This removes the 'Z' and replaces the 'T' characters from the date string which are not necessary (https://www.mysqltutorial.org/mysql-datetime/)

Credit for the fix: https://stackoverflow.com/a/11150727
  • Loading branch information
tgarlanger committed Mar 22, 2021
1 parent f6d2c23 commit 5bef6b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion registry/server/versioning/services/Versioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class Versioning {
data: currentData === null ? null : JSON.stringify(currentData),
data_after: newData === null ? null : JSON.stringify(newData),
created_by: user ? (user as User).identifier : 'unauthenticated',
created_at: new Date().toISOString(),
created_at: new Date().toISOString().slice(0, 19).replace('T', ' '),
};

const [versionID] = await this.db!('versioning').insert(logRecord).transacting(trx);
Expand Down

0 comments on commit 5bef6b0

Please sign in to comment.