This commit is contained in:
Ben Wilson
2023-06-24 20:20:41 -04:00
parent f61e9f1417
commit 9315d200ff
11 changed files with 199 additions and 62 deletions
+14
View File
@@ -0,0 +1,14 @@
import { ValueTransformer } from 'typeorm';
export class DateTimeTransformer implements ValueTransformer {
to(value: Date): any {
// Convert the local time to UTC before saving to the database
const utcTime = value?.toLocaleString();
return utcTime;
}
from(value: any): Date {
// Convert the UTC time from the database to the local time zone
return value;
}
}