|
|
@ -14,12 +14,11 @@ export class GetDateTimePipe implements PipeTransform {
|
|
|
|
transform(slot: Slot): Date {
|
|
|
|
transform(slot: Slot): Date {
|
|
|
|
let result = new Date();
|
|
|
|
let result = new Date();
|
|
|
|
let day = WEEKDAYS.indexOf(slot.label.toLowerCase());
|
|
|
|
let day = WEEKDAYS.indexOf(slot.label.toLowerCase());
|
|
|
|
|
|
|
|
result.setUTCHours(0, 0, 0, 0);
|
|
|
|
result.setDate(result.getDate() + day - result.getDay());
|
|
|
|
result.setDate(result.getDate() + day - result.getDay());
|
|
|
|
let remainder = slot.offset % 60;
|
|
|
|
let remainder = slot.offset % 60;
|
|
|
|
result.setUTCHours(slot.hours - (slot.offset - remainder) / 60 >> 0);
|
|
|
|
result.setUTCHours(slot.hours - (slot.offset - remainder) / 60 >> 0);
|
|
|
|
result.setUTCMinutes(slot.minutes - remainder);
|
|
|
|
result.setUTCMinutes(slot.minutes - remainder);
|
|
|
|
result.setUTCSeconds(0);
|
|
|
|
|
|
|
|
result.setUTCMilliseconds(0);
|
|
|
|
|
|
|
|
if (result.getTime() < Date.now()) {
|
|
|
|
if (result.getTime() < Date.now()) {
|
|
|
|
result.setDate(result.getDate() + 7);
|
|
|
|
result.setDate(result.getDate() + 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|