fix(core): update

This commit is contained in:
2018-11-23 18:29:38 +01:00
parent 6bca8557f9
commit d720b8b084
7 changed files with 52 additions and 40 deletions

View File

@ -24,13 +24,12 @@ export class ExtendedDate extends Date {
const sliceDate = (dateString: string) => {
return `0${dateString}`.slice(-2);
};
const dateTimeString = `${dateArray[3]}-${sliceDate(dateArray[2])}-${sliceDate(dateArray[1])}T${timeArg}`;
const luxonDate = plugins.luxon.DateTime.fromISO(
dateTimeString,
{
zone: zoneArg
}
);
const dateTimeString = `${dateArray[3]}-${sliceDate(dateArray[2])}-${sliceDate(
dateArray[1]
)}T${timeArg}`;
const luxonDate = plugins.luxon.DateTime.fromISO(dateTimeString, {
zone: zoneArg
});
const unixMilli = luxonDate.toMillis();
return new ExtendedDate(unixMilli);
}

View File

@ -70,6 +70,14 @@ export class Timer {
this.currentTimeout = setTimeout(() => {
this.completedDeferred.resolve();
}, this.timeLeft);
} else {
throw new Error('timer has NOT been started before. Please use .start() instead');
}
}
public reset() {
this.pause();
this.startedAt = null;
this.pausedAt = null;
}
}