@storm-stack/plugin-system
Advanced tools
Comparing version 1.5.4 to 1.5.5
@@ -557,11 +557,6 @@ import { ExecaReturnValue } from 'execa'; | ||
*/ | ||
public static create = ( | ||
dateTime?: DateTimeInput, | ||
options?: DateTimeOptions | ||
) => | ||
public static create = (dateTime?: DateTimeInput, options?: DateTimeOptions) => | ||
new StormDateTime(dateTime, { | ||
timeZone: | ||
(StormDateTime.isDateTime(dateTime) | ||
? dateTime.timeZoneId | ||
: options?.timeZone) ?? | ||
(StormDateTime.isDateTime(dateTime) ? dateTime.timeZoneId : options?.timeZone) ?? | ||
process.env.STORM_TIMEZONE ?? | ||
@@ -571,4 +566,3 @@ Temporal.Now.timeZoneId(), | ||
? dateTime.calendarId | ||
: options?.calendar ?? | ||
new Intl.DateTimeFormat().resolvedOptions().calendar | ||
: options?.calendar ?? new Intl.DateTimeFormat().resolvedOptions().calendar | ||
}); | ||
@@ -579,3 +573,3 @@ | ||
*/ | ||
private _instant: Temporal.Instant = Temporal.Now.instant(); | ||
#instant: Temporal.Instant = Temporal.Now.instant(); | ||
@@ -585,3 +579,3 @@ /** | ||
*/ | ||
private _zonedDateTime: Temporal.ZonedDateTime = Temporal.Now.zonedDateTime( | ||
#zonedDateTime: Temporal.ZonedDateTime = Temporal.Now.zonedDateTime( | ||
new Intl.DateTimeFormat().resolvedOptions().calendar, | ||
@@ -594,3 +588,3 @@ process.env.STORM_TIMEZONE ?? Temporal.Now.timeZoneId() | ||
*/ | ||
private _input: DateTimeInput; | ||
#input: DateTimeInput; | ||
@@ -600,27 +594,29 @@ /** | ||
*/ | ||
private _options: DateTimeOptions; | ||
#options: DateTimeOptions; | ||
public constructor(dateTime?: DateTimeInput, options?: DateTimeOptions) { | ||
let _dateTime = dateTime; | ||
const input = dateTime; | ||
if (!dateTime && !options?.skipDefaulting) { | ||
dateTime = Temporal.Now.instant(); | ||
if (!_dateTime && !options?.skipDefaulting) { | ||
_dateTime = Temporal.Now.instant(); | ||
} | ||
const instant = !dateTime | ||
const instant = !_dateTime | ||
? undefined | ||
: StormDateTime.isDateTime(dateTime) | ||
? dateTime.instant | ||
: StormDateTime.isDateTime(_dateTime) | ||
? _dateTime.instant | ||
: Temporal.Instant.from( | ||
isDate(dateTime) | ||
? dateTime.toJSON() | ||
: isObject(dateTime) && "epochMilliseconds" in dateTime | ||
? new Date(Number(dateTime.epochMilliseconds)).toISOString() | ||
: isNumber(dateTime) || isBigInt(dateTime) | ||
? new Date(Number(dateTime)).toISOString() | ||
: dateTime | ||
isDate(_dateTime) | ||
? _dateTime.toJSON() | ||
: isObject(_dateTime) && "epochMilliseconds" in _dateTime | ||
? new Date(Number(_dateTime.epochMilliseconds)).toISOString() | ||
: isNumber(_dateTime) || isBigInt(_dateTime) | ||
? new Date(Number(_dateTime)).toISOString() | ||
: _dateTime | ||
); | ||
super(instant ? Number(instant.epochMilliseconds) : "MISSING_DATE"); | ||
if (instant && this.validate(dateTime, options)) { | ||
this._instant = instant; | ||
if (instant && this.validate(_dateTime, options)) { | ||
this.#instant = instant; | ||
@@ -632,12 +628,12 @@ const timeZone = options?.timeZone | ||
: Temporal.Now.timeZoneId(); | ||
this._zonedDateTime = options?.calendar | ||
? this._instant.toZonedDateTime({ | ||
this.#zonedDateTime = options?.calendar | ||
? this.#instant.toZonedDateTime({ | ||
timeZone, | ||
calendar: options.calendar | ||
}) | ||
: this._instant.toZonedDateTimeISO(timeZone); | ||
: this.#instant.toZonedDateTimeISO(timeZone); | ||
} | ||
this._input = input; | ||
this._options = options ?? {}; | ||
this.#input = input; | ||
this.#options = options ?? {}; | ||
} | ||
@@ -656,3 +652,3 @@ | ||
public get instant(): Temporal.Instant { | ||
return this._instant; | ||
return this.#instant; | ||
} | ||
@@ -663,4 +659,4 @@ | ||
*/ | ||
protected set instant(_instant: Temporal.Instant) { | ||
this._instant = _instant; | ||
protected set instant(instant: Temporal.Instant) { | ||
this.#instant = instant; | ||
} | ||
@@ -672,3 +668,3 @@ | ||
public get zonedDateTime(): Temporal.ZonedDateTime { | ||
return this._zonedDateTime; | ||
return this.#zonedDateTime; | ||
} | ||
@@ -679,4 +675,4 @@ | ||
*/ | ||
protected set zonedDateTime(_zonedDateTime: Temporal.ZonedDateTime) { | ||
this._zonedDateTime = _zonedDateTime; | ||
protected set zonedDateTime(zonedDateTime: Temporal.ZonedDateTime) { | ||
this.#zonedDateTime = zonedDateTime; | ||
} | ||
@@ -688,3 +684,3 @@ | ||
public get calendarId(): string { | ||
return this._zonedDateTime.calendarId; | ||
return this.#zonedDateTime.calendarId; | ||
} | ||
@@ -696,3 +692,3 @@ | ||
public get timeZoneId(): string { | ||
return this._zonedDateTime.timeZoneId; | ||
return this.#zonedDateTime.timeZoneId; | ||
} | ||
@@ -704,3 +700,3 @@ | ||
public get isValid(): boolean { | ||
return this.validate(this._zonedDateTime.epochMilliseconds, this._options); | ||
return this.validate(this.#zonedDateTime.epochMilliseconds, this.#options); | ||
} | ||
@@ -712,3 +708,3 @@ | ||
public get input(): DateTimeInput { | ||
return this._input; | ||
return this.#input; | ||
} | ||
@@ -720,3 +716,3 @@ | ||
public get options(): DateTimeOptions { | ||
return this._options; | ||
return this.#options; | ||
} | ||
@@ -728,9 +724,6 @@ | ||
* @param dateTime - The date value to validate | ||
* @param options - The options to use | ||
* @param _options - The options to use | ||
* @returns A boolean representing whether the value is a valid *date-time* | ||
*/ | ||
protected validate( | ||
value?: DateTimeInput, | ||
options?: DateTimeOptions | ||
): boolean { | ||
protected validate(value?: DateTimeInput, _options?: DateTimeOptions): boolean { | ||
if (StormDateTime.isDateTime(value)) { | ||
@@ -752,3 +745,3 @@ return value.isValid; | ||
if (isNaN(date.getTime())) { | ||
if (Number.isNaN(date.getTime())) { | ||
return false; | ||
@@ -759,4 +752,3 @@ } | ||
} else { | ||
datetime = | ||
value === null || value === void 0 ? void 0 : value.toUpperCase(); | ||
datetime = value === null || value === void 0 ? void 0 : value.toUpperCase(); | ||
} | ||
@@ -792,3 +784,3 @@ | ||
public override getFullYear(): number { | ||
return this._zonedDateTime.year; | ||
return this.#zonedDateTime.year; | ||
} | ||
@@ -800,3 +792,3 @@ | ||
public override getUTCFullYear(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").year; | ||
return this.#instant.toZonedDateTimeISO("UTC").year; | ||
} | ||
@@ -808,3 +800,3 @@ | ||
public override getMonth(): number { | ||
return this._zonedDateTime.month; | ||
return this.#zonedDateTime.month; | ||
} | ||
@@ -816,3 +808,3 @@ | ||
public override getUTCMonth(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").month; | ||
return this.#instant.toZonedDateTimeISO("UTC").month; | ||
} | ||
@@ -824,3 +816,3 @@ | ||
public override getDate(): number { | ||
return this._zonedDateTime.day; | ||
return this.#zonedDateTime.day; | ||
} | ||
@@ -832,3 +824,3 @@ | ||
public override getUTCDate(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").day; | ||
return this.#instant.toZonedDateTimeISO("UTC").day; | ||
} | ||
@@ -840,3 +832,3 @@ | ||
public override getDay(): number { | ||
return this._zonedDateTime.dayOfWeek; | ||
return this.#zonedDateTime.dayOfWeek; | ||
} | ||
@@ -848,3 +840,3 @@ | ||
public override getUTCDay(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").dayOfWeek; | ||
return this.#instant.toZonedDateTimeISO("UTC").dayOfWeek; | ||
} | ||
@@ -856,3 +848,3 @@ | ||
public override getHours(): number { | ||
return this._zonedDateTime.hour; | ||
return this.#zonedDateTime.hour; | ||
} | ||
@@ -864,3 +856,3 @@ | ||
public override getUTCHours(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").hour; | ||
return this.#instant.toZonedDateTimeISO("UTC").hour; | ||
} | ||
@@ -872,3 +864,3 @@ | ||
public override getMinutes(): number { | ||
return this._zonedDateTime.minute; | ||
return this.#zonedDateTime.minute; | ||
} | ||
@@ -880,3 +872,3 @@ | ||
public override getUTCMinutes(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").minute; | ||
return this.#instant.toZonedDateTimeISO("UTC").minute; | ||
} | ||
@@ -888,3 +880,3 @@ | ||
public override getSeconds(): number { | ||
return this._zonedDateTime.second; | ||
return this.#zonedDateTime.second; | ||
} | ||
@@ -896,3 +888,3 @@ | ||
public override getUTCSeconds(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").second; | ||
return this.#instant.toZonedDateTimeISO("UTC").second; | ||
} | ||
@@ -904,3 +896,3 @@ | ||
public override getMilliseconds(): number { | ||
return this._zonedDateTime.millisecond; | ||
return this.#zonedDateTime.millisecond; | ||
} | ||
@@ -912,3 +904,3 @@ | ||
public override getUTCMilliseconds(): number { | ||
return this._instant.toZonedDateTimeISO("UTC").millisecond; | ||
return this.#instant.toZonedDateTimeISO("UTC").millisecond; | ||
} | ||
@@ -920,3 +912,3 @@ | ||
public override getTimezoneOffset(): number { | ||
return this._zonedDateTime.offsetNanoseconds / 1000000; | ||
return this.#zonedDateTime.offsetNanoseconds / 1000000; | ||
} | ||
@@ -929,8 +921,8 @@ | ||
public override setTime(time: number): number { | ||
this._zonedDateTime = this._zonedDateTime.add({ | ||
this.#zonedDateTime = this.#zonedDateTime.add({ | ||
milliseconds: time - this.epochMilliseconds | ||
}); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setTime(this._instant.epochMilliseconds); | ||
return super.setTime(this.#instant.epochMilliseconds); | ||
} | ||
@@ -943,8 +935,6 @@ | ||
public override setMilliseconds(millisecond: number): number { | ||
this._zonedDateTime = this._zonedDateTime.with({ millisecond }); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
this.#zonedDateTime = this.#zonedDateTime.with({ millisecond }); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setMilliseconds( | ||
this._instant.toZonedDateTimeISO("UTC").millisecond | ||
); | ||
return super.setMilliseconds(this.#instant.toZonedDateTimeISO("UTC").millisecond); | ||
} | ||
@@ -957,7 +947,4 @@ | ||
public override setUTCMilliseconds(millisecond: number): number { | ||
this._instant = this._instant | ||
.toZonedDateTimeISO("UTC") | ||
.with({ millisecond }) | ||
.toInstant(); | ||
this._zonedDateTime = this._instant.toZonedDateTime({ | ||
this.#instant = this.#instant.toZonedDateTimeISO("UTC").with({ millisecond }).toInstant(); | ||
this.#zonedDateTime = this.#instant.toZonedDateTime({ | ||
timeZone: this.timeZoneId, | ||
@@ -967,5 +954,3 @@ calendar: this.calendarId | ||
return super.setUTCMilliseconds( | ||
this._instant.toZonedDateTimeISO("UTC").millisecond | ||
); | ||
return super.setUTCMilliseconds(this.#instant.toZonedDateTimeISO("UTC").millisecond); | ||
} | ||
@@ -979,9 +964,6 @@ | ||
public override setSeconds(second: number, millisecond?: number): number { | ||
this._zonedDateTime = this._zonedDateTime.with({ second, millisecond }); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
this.#zonedDateTime = this.#zonedDateTime.with({ second, millisecond }); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setSeconds( | ||
this._zonedDateTime.second, | ||
this._zonedDateTime.millisecond | ||
); | ||
return super.setSeconds(this.#zonedDateTime.second, this.#zonedDateTime.millisecond); | ||
} | ||
@@ -995,7 +977,7 @@ | ||
public override setUTCSeconds(second: number, millisecond?: number): number { | ||
this._instant = this._instant | ||
this.#instant = this.#instant | ||
.toZonedDateTimeISO("UTC") | ||
.with({ second, millisecond }) | ||
.toInstant(); | ||
this._zonedDateTime = this._instant.toZonedDateTime({ | ||
this.#zonedDateTime = this.#instant.toZonedDateTime({ | ||
timeZone: this.timeZoneId, | ||
@@ -1005,3 +987,3 @@ calendar: this.calendarId | ||
const utcDateTime = this._instant.toZonedDateTimeISO("UTC"); | ||
const utcDateTime = this.#instant.toZonedDateTimeISO("UTC"); | ||
return super.setUTCSeconds(utcDateTime.second, utcDateTime.millisecond); | ||
@@ -1016,8 +998,4 @@ } | ||
*/ | ||
public override setMinutes( | ||
minute: number, | ||
second?: number, | ||
millisecond?: number | ||
): number { | ||
this._zonedDateTime = this._zonedDateTime.with({ | ||
public override setMinutes(minute: number, second?: number, millisecond?: number): number { | ||
this.#zonedDateTime = this.#zonedDateTime.with({ | ||
minute, | ||
@@ -1027,8 +1005,8 @@ second, | ||
}); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setMinutes( | ||
this._zonedDateTime.minute, | ||
this._zonedDateTime.second, | ||
this._zonedDateTime.millisecond | ||
this.#zonedDateTime.minute, | ||
this.#zonedDateTime.second, | ||
this.#zonedDateTime.millisecond | ||
); | ||
@@ -1043,12 +1021,8 @@ } | ||
*/ | ||
public override setUTCMinutes( | ||
minute: number, | ||
second?: number, | ||
millisecond?: number | ||
): number { | ||
this._instant = this._instant | ||
public override setUTCMinutes(minute: number, second?: number, millisecond?: number): number { | ||
this.#instant = this.#instant | ||
.toZonedDateTimeISO("UTC") | ||
.with({ minute, second, millisecond }) | ||
.toInstant(); | ||
this._zonedDateTime = this._instant.toZonedDateTime({ | ||
this.#zonedDateTime = this.#instant.toZonedDateTime({ | ||
timeZone: this.timeZoneId, | ||
@@ -1058,8 +1032,4 @@ calendar: this.calendarId | ||
const utcDateTime = this._instant.toZonedDateTimeISO("UTC"); | ||
return super.setUTCMinutes( | ||
utcDateTime.minute, | ||
utcDateTime.second, | ||
utcDateTime.millisecond | ||
); | ||
const utcDateTime = this.#instant.toZonedDateTimeISO("UTC"); | ||
return super.setUTCMinutes(utcDateTime.minute, utcDateTime.second, utcDateTime.millisecond); | ||
} | ||
@@ -1081,3 +1051,3 @@ | ||
): number { | ||
this._zonedDateTime = this._zonedDateTime.with({ | ||
this.#zonedDateTime = this.#zonedDateTime.with({ | ||
hour, | ||
@@ -1088,9 +1058,9 @@ minute, | ||
}); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setHours( | ||
this._zonedDateTime.hour, | ||
this._zonedDateTime.minute, | ||
this._zonedDateTime.second, | ||
this._zonedDateTime.millisecond | ||
this.#zonedDateTime.hour, | ||
this.#zonedDateTime.minute, | ||
this.#zonedDateTime.second, | ||
this.#zonedDateTime.millisecond | ||
); | ||
@@ -1113,7 +1083,7 @@ } | ||
): number { | ||
this._instant = this._instant | ||
this.#instant = this.#instant | ||
.toZonedDateTimeISO("UTC") | ||
.with({ hour, minute, second, millisecond }) | ||
.toInstant(); | ||
this._zonedDateTime = this._instant.toZonedDateTime({ | ||
this.#zonedDateTime = this.#instant.toZonedDateTime({ | ||
timeZone: this.timeZoneId, | ||
@@ -1123,3 +1093,3 @@ calendar: this.calendarId | ||
const utcDateTime = this._instant.toZonedDateTimeISO("UTC"); | ||
const utcDateTime = this.#instant.toZonedDateTimeISO("UTC"); | ||
return super.setUTCHours( | ||
@@ -1139,8 +1109,8 @@ utcDateTime.hour, | ||
public override setDate(day: number): number { | ||
this._zonedDateTime = this._zonedDateTime.with({ | ||
this.#zonedDateTime = this.#zonedDateTime.with({ | ||
day | ||
}); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setDate(this._zonedDateTime.day); | ||
return super.setDate(this.#zonedDateTime.day); | ||
} | ||
@@ -1154,7 +1124,4 @@ | ||
public override setUTCDate(day: number): number { | ||
this._instant = this._instant | ||
.toZonedDateTimeISO("UTC") | ||
.with({ day }) | ||
.toInstant(); | ||
this._zonedDateTime = this._instant.toZonedDateTime({ | ||
this.#instant = this.#instant.toZonedDateTimeISO("UTC").with({ day }).toInstant(); | ||
this.#zonedDateTime = this.#instant.toZonedDateTime({ | ||
timeZone: this.timeZoneId, | ||
@@ -1164,3 +1131,3 @@ calendar: this.calendarId | ||
return super.setUTCDate(this._instant.toZonedDateTimeISO("UTC").day); | ||
return super.setUTCDate(this.#instant.toZonedDateTimeISO("UTC").day); | ||
} | ||
@@ -1175,6 +1142,6 @@ | ||
public override setMonth(month: number, day?: number): number { | ||
this._zonedDateTime = this._zonedDateTime.with({ month, day }); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
this.#zonedDateTime = this.#zonedDateTime.with({ month, day }); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setMonth(this._zonedDateTime.month, this._zonedDateTime.day); | ||
return super.setMonth(this.#zonedDateTime.month, this.#zonedDateTime.day); | ||
} | ||
@@ -1189,7 +1156,4 @@ | ||
public override setUTCMonth(month: number, day?: number): number { | ||
this._instant = this._instant | ||
.toZonedDateTimeISO("UTC") | ||
.with({ month, day }) | ||
.toInstant(); | ||
this._zonedDateTime = this._instant.toZonedDateTime({ | ||
this.#instant = this.#instant.toZonedDateTimeISO("UTC").with({ month, day }).toInstant(); | ||
this.#zonedDateTime = this.#instant.toZonedDateTime({ | ||
timeZone: this.timeZoneId, | ||
@@ -1199,3 +1163,3 @@ calendar: this.calendarId | ||
const utcDateTime = this._instant.toZonedDateTimeISO("UTC"); | ||
const utcDateTime = this.#instant.toZonedDateTimeISO("UTC"); | ||
return super.setUTCMonth(utcDateTime.month, utcDateTime.day); | ||
@@ -1210,14 +1174,10 @@ } | ||
*/ | ||
public override setFullYear( | ||
year: number, | ||
month?: number, | ||
day?: number | ||
): number { | ||
this._zonedDateTime = this._zonedDateTime.with({ year, month, day }); | ||
this._instant = this._zonedDateTime.toInstant(); | ||
public override setFullYear(year: number, month?: number, day?: number): number { | ||
this.#zonedDateTime = this.#zonedDateTime.with({ year, month, day }); | ||
this.#instant = this.#zonedDateTime.toInstant(); | ||
return super.setFullYear( | ||
this._zonedDateTime.year, | ||
this._zonedDateTime.month, | ||
this._zonedDateTime.day | ||
this.#zonedDateTime.year, | ||
this.#zonedDateTime.month, | ||
this.#zonedDateTime.day | ||
); | ||
@@ -1233,12 +1193,5 @@ } | ||
*/ | ||
public override setUTCFullYear( | ||
year: number, | ||
month?: number, | ||
day?: number | ||
): number { | ||
this._instant = this._instant | ||
.toZonedDateTimeISO("UTC") | ||
.with({ year, month, day }) | ||
.toInstant(); | ||
this._zonedDateTime = this._instant.toZonedDateTime({ | ||
public override setUTCFullYear(year: number, month?: number, day?: number): number { | ||
this.#instant = this.#instant.toZonedDateTimeISO("UTC").with({ year, month, day }).toInstant(); | ||
this.#zonedDateTime = this.#instant.toZonedDateTime({ | ||
timeZone: this.timeZoneId, | ||
@@ -1248,8 +1201,4 @@ calendar: this.calendarId | ||
const utcDateTime = this._instant.toZonedDateTimeISO("UTC"); | ||
return super.setUTCFullYear( | ||
utcDateTime.year, | ||
utcDateTime.month, | ||
utcDateTime.day | ||
); | ||
const utcDateTime = this.#instant.toZonedDateTimeISO("UTC"); | ||
return super.setUTCFullYear(utcDateTime.year, utcDateTime.month, utcDateTime.day); | ||
} | ||
@@ -1264,3 +1213,3 @@ | ||
return StormDateTime.create( | ||
this._zonedDateTime.toPlainDate().toZonedDateTime({ | ||
this.#zonedDateTime.toPlainDate().toZonedDateTime({ | ||
timeZone: Temporal.Now.timeZoneId(), | ||
@@ -1270,4 +1219,4 @@ plainTime: undefined | ||
{ | ||
timeZone: this._zonedDateTime.timeZoneId, | ||
calendar: this._zonedDateTime.calendarId | ||
timeZone: this.#zonedDateTime.timeZoneId, | ||
calendar: this.#zonedDateTime.calendarId | ||
} | ||
@@ -1284,3 +1233,3 @@ ); | ||
return StormDateTime.create( | ||
this._zonedDateTime.toPlainTime().toZonedDateTime({ | ||
this.#zonedDateTime.toPlainTime().toZonedDateTime({ | ||
timeZone: Temporal.Now.timeZoneId(), | ||
@@ -1294,4 +1243,4 @@ plainDate: Temporal.PlainDate.from({ | ||
{ | ||
timeZone: this._zonedDateTime.timeZoneId, | ||
calendar: this._zonedDateTime.calendarId | ||
timeZone: this.#zonedDateTime.timeZoneId, | ||
calendar: this.#zonedDateTime.calendarId | ||
} | ||
@@ -1307,6 +1256,4 @@ ); | ||
*/ | ||
public since( | ||
dateTimeTo: StormDateTime = StormDateTime.current() | ||
): Temporal.Duration { | ||
return this._instant.since(dateTimeTo.instant); | ||
public since(dateTimeTo: StormDateTime = StormDateTime.current()): Temporal.Duration { | ||
return this.#instant.since(dateTimeTo.instant); | ||
} | ||
@@ -1320,5 +1267,3 @@ | ||
*/ | ||
public getDuration( | ||
dateTimeTo: StormDateTime = StormDateTime.current() | ||
): Temporal.Duration { | ||
public getDuration(dateTimeTo: StormDateTime = StormDateTime.current()): Temporal.Duration { | ||
return this.instant.since(dateTimeTo.instant); | ||
@@ -1358,14 +1303,8 @@ } | ||
*/ | ||
public static override create = ( | ||
time?: DateTimeInput, | ||
options?: DateTimeOptions | ||
) => | ||
public static override create = (time?: DateTimeInput, options?: DateTimeOptions) => | ||
new StormTime(time, { | ||
timeZone: | ||
(StormDateTime.isDateTime(time) | ||
? time.timeZoneId | ||
: options?.timeZone) ?? Temporal.Now.timeZoneId(), | ||
calendar: StormDateTime.isDateTime(time) | ||
? time.calendarId | ||
: options?.calendar | ||
(StormDateTime.isDateTime(time) ? time.timeZoneId : options?.timeZone) ?? | ||
Temporal.Now.timeZoneId(), | ||
calendar: StormDateTime.isDateTime(time) ? time.calendarId : options?.calendar | ||
}); | ||
@@ -1396,9 +1335,6 @@ | ||
* @param dateTime - The date value to validate | ||
* @param options - The options to use | ||
* @param _options - The options to use | ||
* @returns A boolean representing whether the value is a valid *date-time* | ||
*/ | ||
protected override validate( | ||
value?: DateTimeInput, | ||
options?: DateTimeOptions | ||
): boolean { | ||
protected override validate(value?: DateTimeInput, _options?: DateTimeOptions): boolean { | ||
if (StormDateTime.isDateTime(value)) { | ||
@@ -1420,3 +1356,3 @@ return value.isValid; | ||
if (isNaN(date.getTime())) { | ||
if (Number.isNaN(date.getTime())) { | ||
return false; | ||
@@ -1427,4 +1363,3 @@ } | ||
} else { | ||
datetime = | ||
value === null || value === void 0 ? void 0 : value.toUpperCase(); | ||
datetime = value === null || value === void 0 ? void 0 : value.toUpperCase(); | ||
} | ||
@@ -1501,5 +1436,3 @@ | ||
*/ | ||
public override getDuration( | ||
dateTimeTo: StormTime = StormTime.current() | ||
): Temporal.Duration { | ||
public override getDuration(dateTimeTo: StormTime = StormTime.current()): Temporal.Duration { | ||
return this.instant.since(dateTimeTo.instant); | ||
@@ -1506,0 +1439,0 @@ } |
{ | ||
"name": "@storm-stack/plugin-system", | ||
"version": "1.5.4", | ||
"version": "1.5.5", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "A library used to create and manage a plugin-styled architecture in a TypeScript application.", |
@@ -19,3 +19,3 @@ <!-- START header --> | ||
[![Version](https://img.shields.io/badge/version-1.4.2-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/) | ||
[![Version](https://img.shields.io/badge/version-1.5.5-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/) | ||
[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/) [![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/) ![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6) [![documented with docusaurus](https://img.shields.io/badge/documented_with-docusaurus-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://docusaurus.io/) ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6) | ||
@@ -22,0 +22,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 7 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
8946506
33057
1
0
1