mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 16:02:40 +00:00
fix utc conversion for schedule
This commit is contained in:
@@ -25,22 +25,22 @@ export class Ad {
|
||||
monTime: Date;
|
||||
|
||||
@AutoMap()
|
||||
tueTime: string;
|
||||
tueTime: Date;
|
||||
|
||||
@AutoMap()
|
||||
wedTime: string;
|
||||
wedTime: Date;
|
||||
|
||||
@AutoMap()
|
||||
thuTime: string;
|
||||
thuTime: Date;
|
||||
|
||||
@AutoMap()
|
||||
friTime: string;
|
||||
friTime: Date;
|
||||
|
||||
@AutoMap()
|
||||
satTime: string;
|
||||
satTime: Date;
|
||||
|
||||
@AutoMap()
|
||||
sunTime: string;
|
||||
sunTime: Date;
|
||||
|
||||
@AutoMap()
|
||||
monMargin: number;
|
||||
|
||||
16
src/modules/ad/domain/entities/time-converter.ts
Normal file
16
src/modules/ad/domain/entities/time-converter.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { DateTime, TimeZone } from 'timezonecomplete';
|
||||
|
||||
export class TimeConverter {
|
||||
static toUtcDatetime = (
|
||||
date: string,
|
||||
time: string,
|
||||
ianaTimezone: string,
|
||||
): Date =>
|
||||
date && time
|
||||
? new Date(
|
||||
new DateTime(`${date}T${time}:00`, TimeZone.zone(ianaTimezone, false))
|
||||
.convert(TimeZone.zone('UTC'))
|
||||
.toIsoString(),
|
||||
)
|
||||
: undefined;
|
||||
}
|
||||
Reference in New Issue
Block a user