Comparing version 9.0.0-dev.3 to 9.0.0-dev.4
@@ -9,3 +9,3 @@ declare module "helpers/minitz" { | ||
s: number; | ||
tz: string; | ||
tz?: string; | ||
} | ||
@@ -33,3 +33,3 @@ /** | ||
namespace minitz { | ||
var fromTZISO: (localTimeStr: string, tz: string, throwOnInvalid?: boolean) => Date; | ||
var fromTZISO: (localTimeStr: string, tz?: string, throwOnInvalid?: boolean) => Date; | ||
var fromTZ: (tp: TimePoint, throwOnInvalid?: boolean) => Date; | ||
@@ -45,3 +45,3 @@ var toTZ: (d: Date, tzStr: string) => { | ||
}; | ||
var tp: (y: number, m: number, d: number, h: number, i: number, s: number, tz: string) => { | ||
var tp: (y: number, m: number, d: number, h: number, i: number, s: number, tz?: string) => { | ||
y: number; | ||
@@ -48,0 +48,0 @@ m: number; |
@@ -415,9 +415,9 @@ // src/helpers/minitz.ts | ||
this["dayOfWeek"][index] = this["dayOfWeek"][index] | LAST_OCCURRENCE; | ||
} else if (typeof nthWeekday === "number" && nthWeekday < 6 && nthWeekday > 0) { | ||
} else if (nthWeekday === ANY_OCCURRENCE) { | ||
this["dayOfWeek"][index] = ANY_OCCURRENCE; | ||
} else if (nthWeekday < 6 && nthWeekday > 0) { | ||
this["dayOfWeek"][index] = this["dayOfWeek"][index] | OCCURRENCE_BITMASKS[nthWeekday - 1]; | ||
} else if (typeof nthWeekday === "number" && nthWeekday === ANY_OCCURRENCE) { | ||
this["dayOfWeek"][index] = ANY_OCCURRENCE; | ||
} else { | ||
throw new TypeError( | ||
`CronPattern: nth weekday of of range, should be 1-5 or L. Value: ${nthWeekday}` | ||
`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${nthWeekday}, Type: ${typeof nthWeekday}` | ||
); | ||
@@ -602,3 +602,3 @@ } | ||
if (typeof this.tz === "number") { | ||
const inDate = minitz.fromTZISO(str, "UTC"); | ||
const inDate = minitz.fromTZISO(str); | ||
this.ms = inDate.getUTCMilliseconds(); | ||
@@ -612,4 +612,4 @@ this.second = inDate.getUTCSeconds(); | ||
this.apply(); | ||
} else if (this.tz === void 0) { | ||
return this.fromDate(minitz.fromTZISO(str, this.tz === void 0 ? "UTC" : this.tz)); | ||
} else { | ||
return this.fromDate(minitz.fromTZISO(str, this.tz)); | ||
} | ||
@@ -966,3 +966,3 @@ } | ||
if (next) { | ||
if (prev instanceof CronDate) { | ||
if (prev instanceof CronDate || prev instanceof Date) { | ||
return next.getTime() - prev.getTime(); | ||
@@ -1138,5 +1138,5 @@ } else { | ||
newPrev = this.options.startAt; | ||
let prevTimePlusInterval = prev.getTime() + this.options.interval * 1e3; | ||
let prevTimePlusInterval = newPrev.getTime() + this.options.interval * 1e3; | ||
while (prevTimePlusInterval <= now.getTime()) { | ||
newPrev = new CronDate(prev, this.options.timezone || this.options.utcOffset).increment( | ||
newPrev = new CronDate(newPrev, this.options.timezone || this.options.utcOffset).increment( | ||
this._states.pattern, | ||
@@ -1146,3 +1146,3 @@ this.options, | ||
); | ||
prevTimePlusInterval = prev.getTime() + this.options.interval * 1e3; | ||
prevTimePlusInterval = newPrev.getTime() + this.options.interval * 1e3; | ||
} | ||
@@ -1149,0 +1149,0 @@ hasPreviousRun = true; |
@@ -445,9 +445,9 @@ var base64 = (() => { | ||
this["dayOfWeek"][index] = this["dayOfWeek"][index] | LAST_OCCURRENCE; | ||
} else if (typeof nthWeekday === "number" && nthWeekday < 6 && nthWeekday > 0) { | ||
} else if (nthWeekday === ANY_OCCURRENCE) { | ||
this["dayOfWeek"][index] = ANY_OCCURRENCE; | ||
} else if (nthWeekday < 6 && nthWeekday > 0) { | ||
this["dayOfWeek"][index] = this["dayOfWeek"][index] | OCCURRENCE_BITMASKS[nthWeekday - 1]; | ||
} else if (typeof nthWeekday === "number" && nthWeekday === ANY_OCCURRENCE) { | ||
this["dayOfWeek"][index] = ANY_OCCURRENCE; | ||
} else { | ||
throw new TypeError( | ||
`CronPattern: nth weekday of of range, should be 1-5 or L. Value: ${nthWeekday}` | ||
`CronPattern: nth weekday out of range, should be 1-5 or L. Value: ${nthWeekday}, Type: ${typeof nthWeekday}` | ||
); | ||
@@ -632,3 +632,3 @@ } | ||
if (typeof this.tz === "number") { | ||
const inDate = minitz.fromTZISO(str, "UTC"); | ||
const inDate = minitz.fromTZISO(str); | ||
this.ms = inDate.getUTCMilliseconds(); | ||
@@ -642,4 +642,4 @@ this.second = inDate.getUTCSeconds(); | ||
this.apply(); | ||
} else if (this.tz === void 0) { | ||
return this.fromDate(minitz.fromTZISO(str, this.tz === void 0 ? "UTC" : this.tz)); | ||
} else { | ||
return this.fromDate(minitz.fromTZISO(str, this.tz)); | ||
} | ||
@@ -996,3 +996,3 @@ } | ||
if (next) { | ||
if (prev instanceof CronDate) { | ||
if (prev instanceof CronDate || prev instanceof Date) { | ||
return next.getTime() - prev.getTime(); | ||
@@ -1168,5 +1168,5 @@ } else { | ||
newPrev = this.options.startAt; | ||
let prevTimePlusInterval = prev.getTime() + this.options.interval * 1e3; | ||
let prevTimePlusInterval = newPrev.getTime() + this.options.interval * 1e3; | ||
while (prevTimePlusInterval <= now.getTime()) { | ||
newPrev = new CronDate(prev, this.options.timezone || this.options.utcOffset).increment( | ||
newPrev = new CronDate(newPrev, this.options.timezone || this.options.utcOffset).increment( | ||
this._states.pattern, | ||
@@ -1176,3 +1176,3 @@ this.options, | ||
); | ||
prevTimePlusInterval = prev.getTime() + this.options.interval * 1e3; | ||
prevTimePlusInterval = newPrev.getTime() + this.options.interval * 1e3; | ||
} | ||
@@ -1179,0 +1179,0 @@ hasPreviousRun = true; |
{ | ||
"name": "croner", | ||
"version": "9.0.0-dev.3", | ||
"version": "9.0.0-dev.4", | ||
"description": "Trigger functions and/or evaluate cron expressions in JavaScript. No dependencies. Most features. All environments.", | ||
@@ -5,0 +5,0 @@ "author": "Hexagon <github.com/hexagon>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178524