@internationalized/date
Advanced tools
Comparing version 3.0.0-nightly-fb28ab3b4-241024 to 3.0.0-nightly-fee532d6a-241217
@@ -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 @@ } |
@@ -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 @@ } |
@@ -616,5 +616,2 @@ type Mutable<T> = { | ||
export function createCalendar(name: string): Calendar; | ||
interface ResolvedDateTimeFormatOptions extends Intl.ResolvedDateTimeFormatOptions { | ||
hourCycle?: Intl.DateTimeFormatOptions['hourCycle']; | ||
} | ||
interface DateRangeFormatPart extends Intl.DateTimeFormatPart { | ||
@@ -635,5 +632,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-fb28ab3b4-241024", | ||
"version": "3.0.0-nightly-fee532d6a-241217", | ||
"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 @@ |
@@ -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
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
987684
11863