mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 17:15:03 -07:00
cleaning
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user