Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@internationalized/date

Package Overview
Dependencies
Maintainers
2
Versions
689
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internationalized/date - npm Package Compare versions

Comparing version 3.0.0-nightly-bebc9764a-241010 to 3.0.0-nightly-c53ab48ec-250115

3

dist/BuddhistCalendar.main.js

@@ -44,4 +44,3 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

constructor(...args){
super(...args);
this.identifier = 'buddhist';
super(...args), this.identifier = 'buddhist';
}

@@ -48,0 +47,0 @@ }

@@ -38,4 +38,3 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";

constructor(...args){
super(...args);
this.identifier = 'buddhist';
super(...args), this.identifier = 'buddhist';
}

@@ -42,0 +41,0 @@ }

@@ -166,3 +166,3 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

let millisecond = date.getUTCMilliseconds();
return new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)(year, month, day, timeZone, offset, hour, minute, second, millisecond);
return new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)(year < 1 ? 'BC' : 'AD', year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
}

@@ -169,0 +169,0 @@ function $4ae0260a69729f1d$export$e57ff100d91bd4b9(date, timeZone) {

@@ -147,3 +147,3 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.module.js";

let millisecond = date.getUTCMilliseconds();
return new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(year, month, day, timeZone, offset, hour, minute, second, millisecond);
return new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(year < 1 ? 'BC' : 'AD', year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
}

@@ -150,0 +150,0 @@ function $11d87f3f76e88657$export$e57ff100d91bd4b9(date, timeZone) {

@@ -117,4 +117,3 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

constructor(...args){
super(...args);
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
super(...args), this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
;

@@ -165,4 +164,3 @@ }

constructor(...args){
super(...args);
this.identifier = 'coptic';
super(...args), this.identifier = 'coptic';
}

@@ -169,0 +167,0 @@ }

@@ -109,4 +109,3 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";

constructor(...args){
super(...args);
this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
super(...args), this.identifier = 'ethioaa' // also known as 'ethiopic-amete-alem' in ICU
;

@@ -157,4 +156,3 @@ }

constructor(...args){
super(...args);
this.identifier = 'coptic';
super(...args), this.identifier = 'coptic';
}

@@ -161,0 +159,0 @@ }

@@ -101,4 +101,3 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

constructor(...args){
super(...args);
this.identifier = 'indian';
super(...args), this.identifier = 'indian';
}

@@ -105,0 +104,0 @@ }

@@ -95,4 +95,3 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";

constructor(...args){
super(...args);
this.identifier = 'indian';
super(...args), this.identifier = 'indian';
}

@@ -99,0 +98,0 @@ }

@@ -80,4 +80,3 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

constructor(...args){
super(...args);
this.identifier = 'islamic-tbla';
super(...args), this.identifier = 'islamic-tbla';
}

@@ -150,4 +149,3 @@ }

constructor(){
super();
this.identifier = 'islamic-umalqura';
super(), this.identifier = 'islamic-umalqura';
if (!$ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH) $ecb2c4cc8c9aae25$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($ecb2c4cc8c9aae25$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);

@@ -154,0 +152,0 @@ if (!$ecb2c4cc8c9aae25$var$UMALQURA_YEAR_START_TABLE) {

@@ -72,4 +72,3 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";

constructor(...args){
super(...args);
this.identifier = 'islamic-tbla';
super(...args), this.identifier = 'islamic-tbla';
}

@@ -142,4 +141,3 @@ }

constructor(){
super();
this.identifier = 'islamic-umalqura';
super(), this.identifier = 'islamic-umalqura';
if (!$f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH) $f2f3e0e3a817edbd$var$UMALQURA_MONTHLENGTH = new Uint16Array(Uint8Array.from(atob($f2f3e0e3a817edbd$var$UMALQURA_DATA), (c)=>c.charCodeAt(0)).buffer);

@@ -146,0 +144,0 @@ if (!$f2f3e0e3a817edbd$var$UMALQURA_YEAR_START_TABLE) {

@@ -168,4 +168,3 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

constructor(...args){
super(...args);
this.identifier = 'japanese';
super(...args), this.identifier = 'japanese';
}

@@ -172,0 +171,0 @@ }

@@ -162,4 +162,3 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";

constructor(...args){
super(...args);
this.identifier = 'japanese';
super(...args), this.identifier = 'japanese';
}

@@ -166,0 +165,0 @@ }

@@ -81,7 +81,17 @@ var $4ae0260a69729f1d$exports = require("./conversion.main.js");

}
function $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale) {
const $1f0f7ebf1ae6c530$var$DAY_MAP = {
sun: 0,
mon: 1,
tue: 2,
wed: 3,
thu: 4,
fri: 5,
sat: 6
};
function $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1 - $1f0f7ebf1ae6c530$var$getWeekStart(locale)) % 7;
let weekStart = firstDayOfWeek ? $1f0f7ebf1ae6c530$var$DAY_MAP[firstDayOfWeek] : $1f0f7ebf1ae6c530$var$getWeekStart(locale);
let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;

@@ -148,4 +158,4 @@ return dayOfWeek;

}
function $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale) {
let dayOfWeek = $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale);
function $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek) {
let dayOfWeek = $1f0f7ebf1ae6c530$export$2061056d06d7cdf7(date, locale, firstDayOfWeek);
return date.subtract({

@@ -155,4 +165,4 @@ days: dayOfWeek

}
function $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e(date, locale) {
return $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale).add({
function $1f0f7ebf1ae6c530$export$ef8b6d9133084f4e(date, locale, firstDayOfWeek) {
return $1f0f7ebf1ae6c530$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek).add({
days: 6

@@ -188,5 +198,5 @@ });

}
function $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654(date, locale) {
function $1f0f7ebf1ae6c530$export$ccc1b2479e7dd654(date, locale, firstDayOfWeek) {
let days = date.calendar.getDaysInMonth(date);
return Math.ceil(($1f0f7ebf1ae6c530$export$2061056d06d7cdf7($1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date), locale) + days) / 7);
return Math.ceil(($1f0f7ebf1ae6c530$export$2061056d06d7cdf7($1f0f7ebf1ae6c530$export$a5a3b454ada2268e(date), locale, firstDayOfWeek) + days) / 7);
}

@@ -193,0 +203,0 @@ function $1f0f7ebf1ae6c530$export$5c333a116e949cdd(a, b) {

@@ -49,7 +49,17 @@ import {fromAbsolute as $11d87f3f76e88657$export$1b96692a1ba042ac, toAbsolute as $11d87f3f76e88657$export$5107c82f94518f5c, toCalendar as $11d87f3f76e88657$export$b4a036af3fc0b032, toCalendarDate as $11d87f3f76e88657$export$93522d1a439f3617} from "./conversion.module.js";

}
function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale) {
const $14e0f24ef4ac5c92$var$DAY_MAP = {
sun: 0,
mon: 1,
tue: 2,
wed: 3,
thu: 4,
fri: 5,
sat: 6
};
function $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek) {
let julian = date.calendar.toJulianDay(date);
// If julian is negative, then julian % 7 will be negative, so we adjust
// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1 - $14e0f24ef4ac5c92$var$getWeekStart(locale)) % 7;
let weekStart = firstDayOfWeek ? $14e0f24ef4ac5c92$var$DAY_MAP[firstDayOfWeek] : $14e0f24ef4ac5c92$var$getWeekStart(locale);
let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
if (dayOfWeek < 0) dayOfWeek += 7;

@@ -116,4 +126,4 @@ return dayOfWeek;

}
function $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale) {
let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale);
function $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek) {
let dayOfWeek = $14e0f24ef4ac5c92$export$2061056d06d7cdf7(date, locale, firstDayOfWeek);
return date.subtract({

@@ -123,4 +133,4 @@ days: dayOfWeek

}
function $14e0f24ef4ac5c92$export$ef8b6d9133084f4e(date, locale) {
return $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale).add({
function $14e0f24ef4ac5c92$export$ef8b6d9133084f4e(date, locale, firstDayOfWeek) {
return $14e0f24ef4ac5c92$export$42c81a444fbfb5d4(date, locale, firstDayOfWeek).add({
days: 6

@@ -156,5 +166,5 @@ });

}
function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date, locale) {
function $14e0f24ef4ac5c92$export$ccc1b2479e7dd654(date, locale, firstDayOfWeek) {
let days = date.calendar.getDaysInMonth(date);
return Math.ceil(($14e0f24ef4ac5c92$export$2061056d06d7cdf7($14e0f24ef4ac5c92$export$a5a3b454ada2268e(date), locale) + days) / 7);
return Math.ceil(($14e0f24ef4ac5c92$export$2061056d06d7cdf7($14e0f24ef4ac5c92$export$a5a3b454ada2268e(date), locale, firstDayOfWeek) + days) / 7);
}

@@ -161,0 +171,0 @@ function $14e0f24ef4ac5c92$export$5c333a116e949cdd(a, b) {

@@ -37,6 +37,6 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

const $4c32e2d98e5a5134$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $4c32e2d98e5a5134$var$DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
const $4c32e2d98e5a5134$var$DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $4c32e2d98e5a5134$var$ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const $4c32e2d98e5a5134$var$ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const $4c32e2d98e5a5134$var$DATE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;
const $4c32e2d98e5a5134$var$DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $4c32e2d98e5a5134$var$ZONED_DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const $4c32e2d98e5a5134$var$ABSOLUTE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const $4c32e2d98e5a5134$var$DATE_TIME_DURATION_RE = /^((?<negative>-)|\+)?P((?<years>\d*)Y)?((?<months>\d*)M)?((?<weeks>\d*)W)?((?<days>\d*)D)?((?<time>T)((?<hours>\d*[.,]?\d{1,9})H)?((?<minutes>\d*[.,]?\d{1,9})M)?((?<seconds>\d*[.,]?\d{1,9})S)?)?$/;

@@ -70,3 +70,5 @@ const $4c32e2d98e5a5134$var$requiredDurationTimeGroups = [

if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $625ad1e1f4c43bc1$exports.CalendarDateTime)($4c32e2d98e5a5134$var$parseNumber(m[1], 1, 9999), $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
let year = $4c32e2d98e5a5134$var$parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date = new (0, $625ad1e1f4c43bc1$exports.CalendarDateTime)(era, year < 1 ? -year + 1 : year, $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $4c32e2d98e5a5134$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));

@@ -78,3 +80,5 @@ return date;

if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)($4c32e2d98e5a5134$var$parseNumber(m[1], 1, 9999), $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
let year = $4c32e2d98e5a5134$var$parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date = new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)(era, year < 1 ? -year + 1 : year, $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $4c32e2d98e5a5134$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));

@@ -97,3 +101,5 @@ let plainDateTime = (0, $4ae0260a69729f1d$exports.toCalendarDateTime)(date);

if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)($4c32e2d98e5a5134$var$parseNumber(m[1], 1, 9999), $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
let year = $4c32e2d98e5a5134$var$parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date = new (0, $625ad1e1f4c43bc1$exports.ZonedDateTime)(era, year < 1 ? -year + 1 : year, $4c32e2d98e5a5134$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $4c32e2d98e5a5134$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $4c32e2d98e5a5134$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $4c32e2d98e5a5134$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $4c32e2d98e5a5134$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $4c32e2d98e5a5134$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));

@@ -117,3 +123,6 @@ var _m_;

let gregorianDate = (0, $4ae0260a69729f1d$exports.toCalendar)(date, new (0, $af14c9812fdceb33$exports.GregorianCalendar)());
return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
let year;
if (gregorianDate.era === 'BC') year = gregorianDate.year === 1 ? '0000' : '-' + String(Math.abs(1 - gregorianDate.year)).padStart(6, '00');
else year = String(gregorianDate.year).padStart(4, '0');
return `${year}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
}

@@ -138,7 +147,7 @@ function $4c32e2d98e5a5134$export$4223de14708adc63(date) {

if (!match) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const parseDurationGroup = (group, isNegative, min, max)=>{
const parseDurationGroup = (group, isNegative)=>{
if (!group) return 0;
try {
const sign = isNegative ? -1 : 1;
return sign * $4c32e2d98e5a5134$var$parseNumber(group.replace(',', '.'), min, max);
return sign * Number(group.replace(',', '.'));
} catch {

@@ -163,9 +172,9 @@ throw new Error(`Invalid ISO 8601 Duration string: ${value}`);

const duration = {
years: parseDurationGroup((_match_groups2 = match.groups) === null || _match_groups2 === void 0 ? void 0 : _match_groups2.years, isNegative, 0, 9999),
months: parseDurationGroup((_match_groups3 = match.groups) === null || _match_groups3 === void 0 ? void 0 : _match_groups3.months, isNegative, 0, 12),
weeks: parseDurationGroup((_match_groups4 = match.groups) === null || _match_groups4 === void 0 ? void 0 : _match_groups4.weeks, isNegative, 0, Infinity),
days: parseDurationGroup((_match_groups5 = match.groups) === null || _match_groups5 === void 0 ? void 0 : _match_groups5.days, isNegative, 0, 31),
hours: parseDurationGroup((_match_groups6 = match.groups) === null || _match_groups6 === void 0 ? void 0 : _match_groups6.hours, isNegative, 0, 23),
minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative, 0, 59),
seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative, 0, 59)
years: parseDurationGroup((_match_groups2 = match.groups) === null || _match_groups2 === void 0 ? void 0 : _match_groups2.years, isNegative),
months: parseDurationGroup((_match_groups3 = match.groups) === null || _match_groups3 === void 0 ? void 0 : _match_groups3.months, isNegative),
weeks: parseDurationGroup((_match_groups4 = match.groups) === null || _match_groups4 === void 0 ? void 0 : _match_groups4.weeks, isNegative),
days: parseDurationGroup((_match_groups5 = match.groups) === null || _match_groups5 === void 0 ? void 0 : _match_groups5.days, isNegative),
hours: parseDurationGroup((_match_groups6 = match.groups) === null || _match_groups6 === void 0 ? void 0 : _match_groups6.hours, isNegative),
minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative),
seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative)
};

@@ -172,0 +181,0 @@ if (duration.hours !== undefined && duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);

@@ -21,6 +21,6 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f, CalendarDateTime as $35ea8db9cb2ccb90$export$ca871e8dbb80966f, Time as $35ea8db9cb2ccb90$export$680ea196effce5f, ZonedDateTime as $35ea8db9cb2ccb90$export$d3b7288e7994edea} from "./CalendarDate.module.js";

const $fae977aafc393c5c$var$TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $fae977aafc393c5c$var$DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
const $fae977aafc393c5c$var$DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $fae977aafc393c5c$var$ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const $fae977aafc393c5c$var$ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const $fae977aafc393c5c$var$DATE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;
const $fae977aafc393c5c$var$DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const $fae977aafc393c5c$var$ZONED_DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const $fae977aafc393c5c$var$ABSOLUTE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const $fae977aafc393c5c$var$DATE_TIME_DURATION_RE = /^((?<negative>-)|\+)?P((?<years>\d*)Y)?((?<months>\d*)M)?((?<weeks>\d*)W)?((?<days>\d*)D)?((?<time>T)((?<hours>\d*[.,]?\d{1,9})H)?((?<minutes>\d*[.,]?\d{1,9})M)?((?<seconds>\d*[.,]?\d{1,9})S)?)?$/;

@@ -54,3 +54,5 @@ const $fae977aafc393c5c$var$requiredDurationTimeGroups = [

if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date = new (0, $35ea8db9cb2ccb90$export$ca871e8dbb80966f)(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));

@@ -62,3 +64,5 @@ return date;

if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, m[10], 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));

@@ -81,3 +85,5 @@ let plainDateTime = (0, $11d87f3f76e88657$export$b21e0b124e224484)(date);

if (!m) throw new Error('Invalid ISO 8601 date time string: ' + value);
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)($fae977aafc393c5c$var$parseNumber(m[1], 1, 9999), $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
let year = $fae977aafc393c5c$var$parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date = new (0, $35ea8db9cb2ccb90$export$d3b7288e7994edea)(era, year < 1 ? -year + 1 : year, $fae977aafc393c5c$var$parseNumber(m[2], 1, 12), 1, timeZone, 0, m[4] ? $fae977aafc393c5c$var$parseNumber(m[4], 0, 23) : 0, m[5] ? $fae977aafc393c5c$var$parseNumber(m[5], 0, 59) : 0, m[6] ? $fae977aafc393c5c$var$parseNumber(m[6], 0, 59) : 0, m[7] ? $fae977aafc393c5c$var$parseNumber(m[7], 0, Infinity) * 1000 : 0);
date.day = $fae977aafc393c5c$var$parseNumber(m[3], 0, date.calendar.getDaysInMonth(date));

@@ -101,3 +107,6 @@ var _m_;

let gregorianDate = (0, $11d87f3f76e88657$export$b4a036af3fc0b032)(date, new (0, $3b62074eb05584b2$export$80ee6245ec4f29ec)());
return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
let year;
if (gregorianDate.era === 'BC') year = gregorianDate.year === 1 ? '0000' : '-' + String(Math.abs(1 - gregorianDate.year)).padStart(6, '00');
else year = String(gregorianDate.year).padStart(4, '0');
return `${year}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
}

@@ -122,7 +131,7 @@ function $fae977aafc393c5c$export$4223de14708adc63(date) {

if (!match) throw new Error(`Invalid ISO 8601 Duration string: ${value}`);
const parseDurationGroup = (group, isNegative, min, max)=>{
const parseDurationGroup = (group, isNegative)=>{
if (!group) return 0;
try {
const sign = isNegative ? -1 : 1;
return sign * $fae977aafc393c5c$var$parseNumber(group.replace(',', '.'), min, max);
return sign * Number(group.replace(',', '.'));
} catch {

@@ -147,9 +156,9 @@ throw new Error(`Invalid ISO 8601 Duration string: ${value}`);

const duration = {
years: parseDurationGroup((_match_groups2 = match.groups) === null || _match_groups2 === void 0 ? void 0 : _match_groups2.years, isNegative, 0, 9999),
months: parseDurationGroup((_match_groups3 = match.groups) === null || _match_groups3 === void 0 ? void 0 : _match_groups3.months, isNegative, 0, 12),
weeks: parseDurationGroup((_match_groups4 = match.groups) === null || _match_groups4 === void 0 ? void 0 : _match_groups4.weeks, isNegative, 0, Infinity),
days: parseDurationGroup((_match_groups5 = match.groups) === null || _match_groups5 === void 0 ? void 0 : _match_groups5.days, isNegative, 0, 31),
hours: parseDurationGroup((_match_groups6 = match.groups) === null || _match_groups6 === void 0 ? void 0 : _match_groups6.hours, isNegative, 0, 23),
minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative, 0, 59),
seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative, 0, 59)
years: parseDurationGroup((_match_groups2 = match.groups) === null || _match_groups2 === void 0 ? void 0 : _match_groups2.years, isNegative),
months: parseDurationGroup((_match_groups3 = match.groups) === null || _match_groups3 === void 0 ? void 0 : _match_groups3.months, isNegative),
weeks: parseDurationGroup((_match_groups4 = match.groups) === null || _match_groups4 === void 0 ? void 0 : _match_groups4.weeks, isNegative),
days: parseDurationGroup((_match_groups5 = match.groups) === null || _match_groups5 === void 0 ? void 0 : _match_groups5.days, isNegative),
hours: parseDurationGroup((_match_groups6 = match.groups) === null || _match_groups6 === void 0 ? void 0 : _match_groups6.hours, isNegative),
minutes: parseDurationGroup((_match_groups7 = match.groups) === null || _match_groups7 === void 0 ? void 0 : _match_groups7.minutes, isNegative),
seconds: parseDurationGroup((_match_groups8 = match.groups) === null || _match_groups8 === void 0 ? void 0 : _match_groups8.seconds, isNegative)
};

@@ -156,0 +165,0 @@ if (duration.hours !== undefined && duration.hours % 1 !== 0 && (duration.minutes || duration.seconds)) throw new Error(`Invalid ISO 8601 Duration string: ${value} - only the smallest unit can be fractional`);

@@ -70,4 +70,3 @@ var $625ad1e1f4c43bc1$exports = require("./CalendarDate.main.js");

constructor(...args){
super(...args);
this.identifier = 'roc' // Republic of China
super(...args), this.identifier = 'roc' // Republic of China
;

@@ -74,0 +73,0 @@ }

@@ -64,4 +64,3 @@ import {CalendarDate as $35ea8db9cb2ccb90$export$99faa760c7908e4f} from "./CalendarDate.module.js";

constructor(...args){
super(...args);
this.identifier = 'roc' // Republic of China
super(...args), this.identifier = 'roc' // Republic of China
;

@@ -68,0 +67,0 @@ }

@@ -35,2 +35,3 @@ type Mutable<T> = {

export function isToday(date: DateValue, timeZone: string): boolean;
type DayOfWeek = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
/**

@@ -41,3 +42,3 @@ * Returns the day of week for the given date and locale. Days are numbered from zero to six,

*/
export function getDayOfWeek(date: DateValue, locale: string): number;
export function getDayOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number;
/** Returns the current time in the given time zone. */

@@ -77,13 +78,13 @@ export function now(timeZone: string): ZonedDateTime;

/** Returns the first date of the week for the given date and locale. */
export function startOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;
export function startOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;
export function startOfWeek(date: CalendarDate, locale: string): CalendarDate;
export function startOfWeek(date: DateValue, locale: string): DateValue;
export function startOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;
export function startOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;
export function startOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;
export function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;
/** Returns the last date of the week for the given date and locale. */
export function endOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;
export function endOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;
export function endOfWeek(date: CalendarDate, locale: string): CalendarDate;
export function endOfWeek(date: DateValue, locale: string): DateValue;
export function endOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;
export function endOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;
export function endOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;
export function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;
/** Returns the number of weeks in the given month and locale. */
export function getWeeksInMonth(date: DateValue, locale: string): number;
export function getWeeksInMonth(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number;
/** Returns the lesser of the two provider dates. */

@@ -619,5 +620,2 @@ export function minDate<A extends DateValue, B extends DateValue>(a?: A | null, b?: B | null): A | B | null | undefined;

export function createCalendar(name: string): Calendar;
interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {
hourCycle?: Intl.DateTimeFormatOptions['hourCycle'];
}
interface DateRangeFormatPart extends Intl.DateTimeFormatPart {

@@ -638,5 +636,5 @@ source: 'startRange' | 'endRange' | 'shared';

/** Returns the resolved formatting options based on the values passed to the constructor. */
resolvedOptions(): ResolvedDateTimeFormatOptions;
resolvedOptions(): Intl.ResolvedDateTimeFormatOptions;
}
//# sourceMappingURL=types.d.ts.map
{
"name": "@internationalized/date",
"version": "3.0.0-nightly-bebc9764a-241010",
"version": "3.0.0-nightly-c53ab48ec-250115",
"description": "Internationalized calendar, date, and time manipulation utilities",

@@ -29,4 +29,3 @@ "license": "Apache-2.0",

"access": "public"
},
"stableVersion": "3.5.6"
}
}

@@ -190,3 +190,3 @@ /*

return new ZonedDateTime(year, month, day, timeZone, offset, hour, minute, second, millisecond);
return new ZonedDateTime(year < 1 ? 'BC' : 'AD', year < 1 ? -year + 1 : year, month, day, timeZone, offset, hour, minute, second, millisecond);
}

@@ -193,0 +193,0 @@

@@ -15,6 +15,2 @@ /*

interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions {
hourCycle?: Intl.DateTimeFormatOptions['hourCycle']
}
interface DateRangeFormatPart extends Intl.DateTimeFormatPart {

@@ -83,4 +79,4 @@ source: 'startRange' | 'endRange' | 'shared'

/** Returns the resolved formatting options based on the values passed to the constructor. */
resolvedOptions(): ResolvedDateTimeFormatOptions {
let resolvedOptions = this.formatter.resolvedOptions() as ResolvedDateTimeFormatOptions;
resolvedOptions(): Intl.ResolvedDateTimeFormatOptions {
let resolvedOptions = this.formatter.resolvedOptions();
if (hasBuggyResolvedHourCycle()) {

@@ -161,6 +157,6 @@ if (!this.resolvedHourCycle) {

if (_hasBuggyResolvedHourCycle == null) {
_hasBuggyResolvedHourCycle = (new Intl.DateTimeFormat('fr', {
_hasBuggyResolvedHourCycle = new Intl.DateTimeFormat('fr', {
hour: 'numeric',
hour12: false
}).resolvedOptions() as ResolvedDateTimeFormatOptions).hourCycle === 'h12';
}).resolvedOptions().hourCycle === 'h12';
}

@@ -167,0 +163,0 @@

@@ -67,2 +67,14 @@ /*

const DAY_MAP = {
sun: 0,
mon: 1,
tue: 2,
wed: 3,
thu: 4,
fri: 5,
sat: 6
};
type DayOfWeek = 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat';
/**

@@ -73,3 +85,3 @@ * Returns the day of week for the given date and locale. Days are numbered from zero to six,

*/
export function getDayOfWeek(date: DateValue, locale: string): number {
export function getDayOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number {
let julian = date.calendar.toJulianDay(date);

@@ -79,3 +91,4 @@

// accordingly. Julian day 0 is Monday.
let dayOfWeek = Math.ceil(julian + 1 - getWeekStart(locale)) % 7;
let weekStart = firstDayOfWeek ? DAY_MAP[firstDayOfWeek] : getWeekStart(locale);
let dayOfWeek = Math.ceil(julian + 1 - weekStart) % 7;
if (dayOfWeek < 0) {

@@ -187,8 +200,8 @@ dayOfWeek += 7;

/** Returns the first date of the week for the given date and locale. */
export function startOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;
export function startOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;
export function startOfWeek(date: CalendarDate, locale: string): CalendarDate;
export function startOfWeek(date: DateValue, locale: string): DateValue;
export function startOfWeek(date: DateValue, locale: string): DateValue {
let dayOfWeek = getDayOfWeek(date, locale);
export function startOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;
export function startOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;
export function startOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;
export function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;
export function startOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue {
let dayOfWeek = getDayOfWeek(date, locale, firstDayOfWeek);
return date.subtract({days: dayOfWeek});

@@ -198,8 +211,8 @@ }

/** Returns the last date of the week for the given date and locale. */
export function endOfWeek(date: ZonedDateTime, locale: string): ZonedDateTime;
export function endOfWeek(date: CalendarDateTime, locale: string): CalendarDateTime;
export function endOfWeek(date: CalendarDate, locale: string): CalendarDate;
export function endOfWeek(date: DateValue, locale: string): DateValue;
export function endOfWeek(date: DateValue, locale: string): DateValue {
return startOfWeek(date, locale).add({days: 6});
export function endOfWeek(date: ZonedDateTime, locale: string, firstDayOfWeek?: DayOfWeek): ZonedDateTime;
export function endOfWeek(date: CalendarDateTime, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDateTime;
export function endOfWeek(date: CalendarDate, locale: string, firstDayOfWeek?: DayOfWeek): CalendarDate;
export function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue;
export function endOfWeek(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): DateValue {
return startOfWeek(date, locale, firstDayOfWeek).add({days: 6});
}

@@ -241,5 +254,5 @@

/** Returns the number of weeks in the given month and locale. */
export function getWeeksInMonth(date: DateValue, locale: string): number {
export function getWeeksInMonth(date: DateValue, locale: string, firstDayOfWeek?: DayOfWeek): number {
let days = date.calendar.getDaysInMonth(date);
return Math.ceil((getDayOfWeek(startOfMonth(date), locale) + days) / 7);
return Math.ceil((getDayOfWeek(startOfMonth(date), locale, firstDayOfWeek) + days) / 7);
}

@@ -246,0 +259,0 @@

@@ -21,6 +21,6 @@ /*

const TIME_RE = /^(\d{2})(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
const DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const ZONED_DATE_TIME_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const ABSOLUTE_RE = /^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const DATE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})$/;
const DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?$/;
const ZONED_DATE_TIME_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:([+-]\d{2})(?::?(\d{2}))?)?\[(.*?)\]$/;
const ABSOLUTE_RE = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})(?:T(\d{2}))?(?::(\d{2}))?(?::(\d{2}))?(\.\d+)?(?:(?:([+-]\d{2})(?::?(\d{2}))?)|Z)$/;
const DATE_TIME_DURATION_RE =

@@ -70,4 +70,8 @@ /^((?<negative>-)|\+)?P((?<years>\d*)Y)?((?<months>\d*)M)?((?<weeks>\d*)W)?((?<days>\d*)D)?((?<time>T)((?<hours>\d*[.,]?\d{1,9})H)?((?<minutes>\d*[.,]?\d{1,9})M)?((?<seconds>\d*[.,]?\d{1,9})S)?)?$/;

let year = parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date: Mutable<CalendarDateTime> = new CalendarDateTime(
parseNumber(m[1], 1, 9999),
era,
year < 1 ? -year + 1 : year,
parseNumber(m[2], 1, 12),

@@ -97,4 +101,8 @@ 1,

let year = parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date: Mutable<ZonedDateTime> = new ZonedDateTime(
parseNumber(m[1], 1, 9999),
era,
year < 1 ? -year + 1 : year,
parseNumber(m[2], 1, 12),

@@ -142,4 +150,8 @@ 1,

let year = parseNumber(m[1], -9999, 9999);
let era = year < 1 ? 'BC' : 'AD';
let date: Mutable<ZonedDateTime> = new ZonedDateTime(
parseNumber(m[1], 1, 9999),
era,
year < 1 ? -year + 1 : year,
parseNumber(m[2], 1, 12),

@@ -187,3 +199,11 @@ 1,

let gregorianDate = toCalendar(date, new GregorianCalendar());
return `${String(gregorianDate.year).padStart(4, '0')}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
let year: string;
if (gregorianDate.era === 'BC') {
year = gregorianDate.year === 1
? '0000'
: '-' + String(Math.abs(1 - gregorianDate.year)).padStart(6, '00');
} else {
year = String(gregorianDate.year).padStart(4, '0');
}
return `${year}-${String(gregorianDate.month).padStart(2, '0')}-${String(gregorianDate.day).padStart(2, '0')}`;
}

@@ -222,5 +242,3 @@

group: string | undefined,
isNegative: boolean,
min: number,
max: number
isNegative: boolean
): number => {

@@ -232,3 +250,3 @@ if (!group) {

const sign = isNegative ? -1 : 1;
return sign * parseNumber(group.replace(',', '.'), min, max);
return sign * Number(group.replace(',', '.'));
} catch {

@@ -257,9 +275,9 @@ throw new Error(`Invalid ISO 8601 Duration string: ${value}`);

const duration: Mutable<DateTimeDuration> = {
years: parseDurationGroup(match.groups?.years, isNegative, 0, 9999),
months: parseDurationGroup(match.groups?.months, isNegative, 0, 12),
weeks: parseDurationGroup(match.groups?.weeks, isNegative, 0, Infinity),
days: parseDurationGroup(match.groups?.days, isNegative, 0, 31),
hours: parseDurationGroup(match.groups?.hours, isNegative, 0, 23),
minutes: parseDurationGroup(match.groups?.minutes, isNegative, 0, 59),
seconds: parseDurationGroup(match.groups?.seconds, isNegative, 0, 59)
years: parseDurationGroup(match.groups?.years, isNegative),
months: parseDurationGroup(match.groups?.months, isNegative),
weeks: parseDurationGroup(match.groups?.weeks, isNegative),
days: parseDurationGroup(match.groups?.days, isNegative),
hours: parseDurationGroup(match.groups?.hours, isNegative),
minutes: parseDurationGroup(match.groups?.minutes, isNegative),
seconds: parseDurationGroup(match.groups?.seconds, isNegative)
};

@@ -266,0 +284,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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc