@cdx-ui/formatters 0.0.1-beta.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/lib/commonjs/dates/calendar/formatCalendarMonthYear.js +28 -0
- package/lib/commonjs/dates/calendar/formatCalendarMonthYear.js.map +1 -0
- package/lib/commonjs/dates/calendar/formatDateTimeListDateRow.js +40 -0
- package/lib/commonjs/dates/calendar/formatDateTimeListDateRow.js.map +1 -0
- package/lib/commonjs/dates/calendar/formatMonthCalendarMonth.js +28 -0
- package/lib/commonjs/dates/calendar/formatMonthCalendarMonth.js.map +1 -0
- package/lib/commonjs/dates/calendar/formatMonthCalendarYear.js +16 -0
- package/lib/commonjs/dates/calendar/formatMonthCalendarYear.js.map +1 -0
- package/lib/commonjs/dates/calendar/getCalendarWeekdayLabels.js +23 -0
- package/lib/commonjs/dates/calendar/getCalendarWeekdayLabels.js.map +1 -0
- package/lib/commonjs/dates/datetime/clampDateTimeId.js +27 -0
- package/lib/commonjs/dates/datetime/clampDateTimeId.js.map +1 -0
- package/lib/commonjs/dates/datetime/compareDateTimeIds.js +28 -0
- package/lib/commonjs/dates/datetime/compareDateTimeIds.js.map +1 -0
- package/lib/commonjs/dates/datetime/dateTimeId.js +38 -0
- package/lib/commonjs/dates/datetime/dateTimeId.js.map +1 -0
- package/lib/commonjs/dates/datetime/formatDateTimeId.js +27 -0
- package/lib/commonjs/dates/datetime/formatDateTimeId.js.map +1 -0
- package/lib/commonjs/dates/datetime/formatDateTimeListHour.js +21 -0
- package/lib/commonjs/dates/datetime/formatDateTimeListHour.js.map +1 -0
- package/lib/commonjs/dates/datetime/formatDateTimeListMinute.js +16 -0
- package/lib/commonjs/dates/datetime/formatDateTimeListMinute.js.map +1 -0
- package/lib/commonjs/dates/datetime/formatDateTimeListPeriod.js +17 -0
- package/lib/commonjs/dates/datetime/formatDateTimeListPeriod.js.map +1 -0
- package/lib/commonjs/dates/datetime/isLocaleHour12.js +30 -0
- package/lib/commonjs/dates/datetime/isLocaleHour12.js.map +1 -0
- package/lib/commonjs/dates/datetime/isValidDateTimeId.js +23 -0
- package/lib/commonjs/dates/datetime/isValidDateTimeId.js.map +1 -0
- package/lib/commonjs/dates/datetime/nowDateTimeId.js +57 -0
- package/lib/commonjs/dates/datetime/nowDateTimeId.js.map +1 -0
- package/lib/commonjs/dates/datetime/parseDateTimeId.js +29 -0
- package/lib/commonjs/dates/datetime/parseDateTimeId.js.map +1 -0
- package/lib/commonjs/dates/display/formatDateForDisplay.js +28 -0
- package/lib/commonjs/dates/display/formatDateForDisplay.js.map +1 -0
- package/lib/commonjs/dates/display/formatDateRangeForDisplay.js +25 -0
- package/lib/commonjs/dates/display/formatDateRangeForDisplay.js.map +1 -0
- package/lib/commonjs/dates/display/formatDateTimeForDisplay.js +34 -0
- package/lib/commonjs/dates/display/formatDateTimeForDisplay.js.map +1 -0
- package/lib/commonjs/dates/display/formatMonthForDisplay.js +33 -0
- package/lib/commonjs/dates/display/formatMonthForDisplay.js.map +1 -0
- package/lib/commonjs/dates/index.js +367 -0
- package/lib/commonjs/dates/index.js.map +1 -0
- package/lib/commonjs/dates/internal/brand.js +19 -0
- package/lib/commonjs/dates/internal/brand.js.map +1 -0
- package/lib/commonjs/dates/internal/calendarHelpers.js +22 -0
- package/lib/commonjs/dates/internal/calendarHelpers.js.map +1 -0
- package/lib/commonjs/dates/internal/clampHelpers.js +20 -0
- package/lib/commonjs/dates/internal/clampHelpers.js.map +1 -0
- package/lib/commonjs/dates/internal/dateIdToNativeDate.js +20 -0
- package/lib/commonjs/dates/internal/dateIdToNativeDate.js.map +1 -0
- package/lib/commonjs/dates/internal/intlCache.js +52 -0
- package/lib/commonjs/dates/internal/intlCache.js.map +1 -0
- package/lib/commonjs/dates/internal/intlCopy.js +72 -0
- package/lib/commonjs/dates/internal/intlCopy.js.map +1 -0
- package/lib/commonjs/dates/internal/segmentBuilders.js +98 -0
- package/lib/commonjs/dates/internal/segmentBuilders.js.map +1 -0
- package/lib/commonjs/dates/labels/dateComponentLabels.js +57 -0
- package/lib/commonjs/dates/labels/dateComponentLabels.js.map +1 -0
- package/lib/commonjs/dates/ranges/compareDateIds.js +26 -0
- package/lib/commonjs/dates/ranges/compareDateIds.js.map +1 -0
- package/lib/commonjs/dates/ranges/compareMonthIds.js +31 -0
- package/lib/commonjs/dates/ranges/compareMonthIds.js.map +1 -0
- package/lib/commonjs/dates/ranges/dateRangeAroundDay.js +25 -0
- package/lib/commonjs/dates/ranges/dateRangeAroundDay.js.map +1 -0
- package/lib/commonjs/dates/ranges/dateRangeFromLastNDays.js +28 -0
- package/lib/commonjs/dates/ranges/dateRangeFromLastNDays.js.map +1 -0
- package/lib/commonjs/dates/ranges/eachDateIdInRange.js +29 -0
- package/lib/commonjs/dates/ranges/eachDateIdInRange.js.map +1 -0
- package/lib/commonjs/dates/ranges/normalizeDateRange.js +23 -0
- package/lib/commonjs/dates/ranges/normalizeDateRange.js.map +1 -0
- package/lib/commonjs/dates/segments/applyDateSegmentChange.js +77 -0
- package/lib/commonjs/dates/segments/applyDateSegmentChange.js.map +1 -0
- package/lib/commonjs/dates/segments/formatDateSegment.js +19 -0
- package/lib/commonjs/dates/segments/formatDateSegment.js.map +1 -0
- package/lib/commonjs/dates/segments/getDateFieldSegments.js +44 -0
- package/lib/commonjs/dates/segments/getDateFieldSegments.js.map +1 -0
- package/lib/commonjs/dates/segments/getDateTimeFieldSegments.js +150 -0
- package/lib/commonjs/dates/segments/getDateTimeFieldSegments.js.map +1 -0
- package/lib/commonjs/dates/segments/getDateTimeSegmentVisibility.js +15 -0
- package/lib/commonjs/dates/segments/getDateTimeSegmentVisibility.js.map +1 -0
- package/lib/commonjs/dates/segments/getEmptyDateSegmentText.js +17 -0
- package/lib/commonjs/dates/segments/getEmptyDateSegmentText.js.map +1 -0
- package/lib/commonjs/dates/segments/parseDateSegment.js +26 -0
- package/lib/commonjs/dates/segments/parseDateSegment.js.map +1 -0
- package/lib/commonjs/dates/types.js +2 -0
- package/lib/commonjs/dates/types.js.map +1 -0
- package/lib/commonjs/dates/wire/clampDateParts.js +26 -0
- package/lib/commonjs/dates/wire/clampDateParts.js.map +1 -0
- package/lib/commonjs/dates/wire/clampMonthParts.js +23 -0
- package/lib/commonjs/dates/wire/clampMonthParts.js.map +1 -0
- package/lib/commonjs/dates/wire/dateId.js +50 -0
- package/lib/commonjs/dates/wire/dateId.js.map +1 -0
- package/lib/commonjs/dates/wire/formatDateId.js +25 -0
- package/lib/commonjs/dates/wire/formatDateId.js.map +1 -0
- package/lib/commonjs/dates/wire/formatMonthId.js +21 -0
- package/lib/commonjs/dates/wire/formatMonthId.js.map +1 -0
- package/lib/commonjs/dates/wire/isValidDateId.js +27 -0
- package/lib/commonjs/dates/wire/isValidDateId.js.map +1 -0
- package/lib/commonjs/dates/wire/isValidDateParts.js +18 -0
- package/lib/commonjs/dates/wire/isValidDateParts.js.map +1 -0
- package/lib/commonjs/dates/wire/isValidMonthId.js +27 -0
- package/lib/commonjs/dates/wire/isValidMonthId.js.map +1 -0
- package/lib/commonjs/dates/wire/isValidMonthParts.js +16 -0
- package/lib/commonjs/dates/wire/isValidMonthParts.js.map +1 -0
- package/lib/commonjs/dates/wire/monthId.js +47 -0
- package/lib/commonjs/dates/wire/monthId.js.map +1 -0
- package/lib/commonjs/dates/wire/parseDateId.js +29 -0
- package/lib/commonjs/dates/wire/parseDateId.js.map +1 -0
- package/lib/commonjs/dates/wire/parseMonthId.js +28 -0
- package/lib/commonjs/dates/wire/parseMonthId.js.map +1 -0
- package/lib/commonjs/dates/wire/toMonthId.js +22 -0
- package/lib/commonjs/dates/wire/toMonthId.js.map +1 -0
- package/lib/commonjs/dates/wire/todayDateId.js +17 -0
- package/lib/commonjs/dates/wire/todayDateId.js.map +1 -0
- package/lib/commonjs/dates/wire/todayMonthId.js +17 -0
- package/lib/commonjs/dates/wire/todayMonthId.js.map +1 -0
- package/lib/commonjs/formatNumber.js +50 -0
- package/lib/commonjs/formatNumber.js.map +1 -0
- package/lib/commonjs/index.js +326 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/commonjs/utils.js +33 -0
- package/lib/commonjs/utils.js.map +1 -0
- package/lib/module/dates/calendar/formatCalendarMonthYear.js +24 -0
- package/lib/module/dates/calendar/formatCalendarMonthYear.js.map +1 -0
- package/lib/module/dates/calendar/formatDateTimeListDateRow.js +36 -0
- package/lib/module/dates/calendar/formatDateTimeListDateRow.js.map +1 -0
- package/lib/module/dates/calendar/formatMonthCalendarMonth.js +24 -0
- package/lib/module/dates/calendar/formatMonthCalendarMonth.js.map +1 -0
- package/lib/module/dates/calendar/formatMonthCalendarYear.js +12 -0
- package/lib/module/dates/calendar/formatMonthCalendarYear.js.map +1 -0
- package/lib/module/dates/calendar/getCalendarWeekdayLabels.js +19 -0
- package/lib/module/dates/calendar/getCalendarWeekdayLabels.js.map +1 -0
- package/lib/module/dates/datetime/clampDateTimeId.js +24 -0
- package/lib/module/dates/datetime/clampDateTimeId.js.map +1 -0
- package/lib/module/dates/datetime/compareDateTimeIds.js +24 -0
- package/lib/module/dates/datetime/compareDateTimeIds.js.map +1 -0
- package/lib/module/dates/datetime/dateTimeId.js +35 -0
- package/lib/module/dates/datetime/dateTimeId.js.map +1 -0
- package/lib/module/dates/datetime/formatDateTimeId.js +23 -0
- package/lib/module/dates/datetime/formatDateTimeId.js.map +1 -0
- package/lib/module/dates/datetime/formatDateTimeListHour.js +17 -0
- package/lib/module/dates/datetime/formatDateTimeListHour.js.map +1 -0
- package/lib/module/dates/datetime/formatDateTimeListMinute.js +12 -0
- package/lib/module/dates/datetime/formatDateTimeListMinute.js.map +1 -0
- package/lib/module/dates/datetime/formatDateTimeListPeriod.js +13 -0
- package/lib/module/dates/datetime/formatDateTimeListPeriod.js.map +1 -0
- package/lib/module/dates/datetime/isLocaleHour12.js +26 -0
- package/lib/module/dates/datetime/isLocaleHour12.js.map +1 -0
- package/lib/module/dates/datetime/isValidDateTimeId.js +19 -0
- package/lib/module/dates/datetime/isValidDateTimeId.js.map +1 -0
- package/lib/module/dates/datetime/nowDateTimeId.js +54 -0
- package/lib/module/dates/datetime/nowDateTimeId.js.map +1 -0
- package/lib/module/dates/datetime/parseDateTimeId.js +26 -0
- package/lib/module/dates/datetime/parseDateTimeId.js.map +1 -0
- package/lib/module/dates/display/formatDateForDisplay.js +24 -0
- package/lib/module/dates/display/formatDateForDisplay.js.map +1 -0
- package/lib/module/dates/display/formatDateRangeForDisplay.js +22 -0
- package/lib/module/dates/display/formatDateRangeForDisplay.js.map +1 -0
- package/lib/module/dates/display/formatDateTimeForDisplay.js +30 -0
- package/lib/module/dates/display/formatDateTimeForDisplay.js.map +1 -0
- package/lib/module/dates/display/formatMonthForDisplay.js +29 -0
- package/lib/module/dates/display/formatMonthForDisplay.js.map +1 -0
- package/lib/module/dates/index.js +59 -0
- package/lib/module/dates/index.js.map +1 -0
- package/lib/module/dates/internal/brand.js +12 -0
- package/lib/module/dates/internal/brand.js.map +1 -0
- package/lib/module/dates/internal/calendarHelpers.js +19 -0
- package/lib/module/dates/internal/calendarHelpers.js.map +1 -0
- package/lib/module/dates/internal/clampHelpers.js +14 -0
- package/lib/module/dates/internal/clampHelpers.js.map +1 -0
- package/lib/module/dates/internal/dateIdToNativeDate.js +16 -0
- package/lib/module/dates/internal/dateIdToNativeDate.js.map +1 -0
- package/lib/module/dates/internal/intlCache.js +47 -0
- package/lib/module/dates/internal/intlCache.js.map +1 -0
- package/lib/module/dates/internal/intlCopy.js +66 -0
- package/lib/module/dates/internal/intlCopy.js.map +1 -0
- package/lib/module/dates/internal/segmentBuilders.js +91 -0
- package/lib/module/dates/internal/segmentBuilders.js.map +1 -0
- package/lib/module/dates/labels/dateComponentLabels.js +50 -0
- package/lib/module/dates/labels/dateComponentLabels.js.map +1 -0
- package/lib/module/dates/ranges/compareDateIds.js +22 -0
- package/lib/module/dates/ranges/compareDateIds.js.map +1 -0
- package/lib/module/dates/ranges/compareMonthIds.js +27 -0
- package/lib/module/dates/ranges/compareMonthIds.js.map +1 -0
- package/lib/module/dates/ranges/dateRangeAroundDay.js +21 -0
- package/lib/module/dates/ranges/dateRangeAroundDay.js.map +1 -0
- package/lib/module/dates/ranges/dateRangeFromLastNDays.js +24 -0
- package/lib/module/dates/ranges/dateRangeFromLastNDays.js.map +1 -0
- package/lib/module/dates/ranges/eachDateIdInRange.js +26 -0
- package/lib/module/dates/ranges/eachDateIdInRange.js.map +1 -0
- package/lib/module/dates/ranges/normalizeDateRange.js +20 -0
- package/lib/module/dates/ranges/normalizeDateRange.js.map +1 -0
- package/lib/module/dates/segments/applyDateSegmentChange.js +73 -0
- package/lib/module/dates/segments/applyDateSegmentChange.js.map +1 -0
- package/lib/module/dates/segments/formatDateSegment.js +15 -0
- package/lib/module/dates/segments/formatDateSegment.js.map +1 -0
- package/lib/module/dates/segments/getDateFieldSegments.js +40 -0
- package/lib/module/dates/segments/getDateFieldSegments.js.map +1 -0
- package/lib/module/dates/segments/getDateTimeFieldSegments.js +147 -0
- package/lib/module/dates/segments/getDateTimeFieldSegments.js.map +1 -0
- package/lib/module/dates/segments/getDateTimeSegmentVisibility.js +11 -0
- package/lib/module/dates/segments/getDateTimeSegmentVisibility.js.map +1 -0
- package/lib/module/dates/segments/getEmptyDateSegmentText.js +13 -0
- package/lib/module/dates/segments/getEmptyDateSegmentText.js.map +1 -0
- package/lib/module/dates/segments/parseDateSegment.js +22 -0
- package/lib/module/dates/segments/parseDateSegment.js.map +1 -0
- package/lib/module/dates/types.js +2 -0
- package/lib/module/dates/types.js.map +1 -0
- package/lib/module/dates/wire/clampDateParts.js +22 -0
- package/lib/module/dates/wire/clampDateParts.js.map +1 -0
- package/lib/module/dates/wire/clampMonthParts.js +19 -0
- package/lib/module/dates/wire/clampMonthParts.js.map +1 -0
- package/lib/module/dates/wire/dateId.js +47 -0
- package/lib/module/dates/wire/dateId.js.map +1 -0
- package/lib/module/dates/wire/formatDateId.js +22 -0
- package/lib/module/dates/wire/formatDateId.js.map +1 -0
- package/lib/module/dates/wire/formatMonthId.js +17 -0
- package/lib/module/dates/wire/formatMonthId.js.map +1 -0
- package/lib/module/dates/wire/isValidDateId.js +23 -0
- package/lib/module/dates/wire/isValidDateId.js.map +1 -0
- package/lib/module/dates/wire/isValidDateParts.js +14 -0
- package/lib/module/dates/wire/isValidDateParts.js.map +1 -0
- package/lib/module/dates/wire/isValidMonthId.js +23 -0
- package/lib/module/dates/wire/isValidMonthId.js.map +1 -0
- package/lib/module/dates/wire/isValidMonthParts.js +12 -0
- package/lib/module/dates/wire/isValidMonthParts.js.map +1 -0
- package/lib/module/dates/wire/monthId.js +44 -0
- package/lib/module/dates/wire/monthId.js.map +1 -0
- package/lib/module/dates/wire/parseDateId.js +26 -0
- package/lib/module/dates/wire/parseDateId.js.map +1 -0
- package/lib/module/dates/wire/parseMonthId.js +25 -0
- package/lib/module/dates/wire/parseMonthId.js.map +1 -0
- package/lib/module/dates/wire/toMonthId.js +18 -0
- package/lib/module/dates/wire/toMonthId.js.map +1 -0
- package/lib/module/dates/wire/todayDateId.js +13 -0
- package/lib/module/dates/wire/todayDateId.js.map +1 -0
- package/lib/module/dates/wire/todayMonthId.js +13 -0
- package/lib/module/dates/wire/todayMonthId.js.map +1 -0
- package/lib/module/formatNumber.js +46 -0
- package/lib/module/formatNumber.js.map +1 -0
- package/lib/module/index.js +17 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/utils.js +29 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/typescript/dates/calendar/formatCalendarMonthYear.d.ts +12 -0
- package/lib/typescript/dates/calendar/formatCalendarMonthYear.d.ts.map +1 -0
- package/lib/typescript/dates/calendar/formatDateTimeListDateRow.d.ts +13 -0
- package/lib/typescript/dates/calendar/formatDateTimeListDateRow.d.ts.map +1 -0
- package/lib/typescript/dates/calendar/formatMonthCalendarMonth.d.ts +13 -0
- package/lib/typescript/dates/calendar/formatMonthCalendarMonth.d.ts.map +1 -0
- package/lib/typescript/dates/calendar/formatMonthCalendarYear.d.ts +8 -0
- package/lib/typescript/dates/calendar/formatMonthCalendarYear.d.ts.map +1 -0
- package/lib/typescript/dates/calendar/getCalendarWeekdayLabels.d.ts +12 -0
- package/lib/typescript/dates/calendar/getCalendarWeekdayLabels.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/clampDateTimeId.d.ts +16 -0
- package/lib/typescript/dates/datetime/clampDateTimeId.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/compareDateTimeIds.d.ts +13 -0
- package/lib/typescript/dates/datetime/compareDateTimeIds.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/dateTimeId.d.ts +18 -0
- package/lib/typescript/dates/datetime/dateTimeId.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/formatDateTimeId.d.ts +12 -0
- package/lib/typescript/dates/datetime/formatDateTimeId.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/formatDateTimeListHour.d.ts +11 -0
- package/lib/typescript/dates/datetime/formatDateTimeListHour.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/formatDateTimeListMinute.d.ts +8 -0
- package/lib/typescript/dates/datetime/formatDateTimeListMinute.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/formatDateTimeListPeriod.d.ts +9 -0
- package/lib/typescript/dates/datetime/formatDateTimeListPeriod.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/isLocaleHour12.d.ts +12 -0
- package/lib/typescript/dates/datetime/isLocaleHour12.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/isValidDateTimeId.d.ts +9 -0
- package/lib/typescript/dates/datetime/isValidDateTimeId.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/nowDateTimeId.d.ts +14 -0
- package/lib/typescript/dates/datetime/nowDateTimeId.d.ts.map +1 -0
- package/lib/typescript/dates/datetime/parseDateTimeId.d.ts +9 -0
- package/lib/typescript/dates/datetime/parseDateTimeId.d.ts.map +1 -0
- package/lib/typescript/dates/display/formatDateForDisplay.d.ts +13 -0
- package/lib/typescript/dates/display/formatDateForDisplay.d.ts.map +1 -0
- package/lib/typescript/dates/display/formatDateRangeForDisplay.d.ts +16 -0
- package/lib/typescript/dates/display/formatDateRangeForDisplay.d.ts.map +1 -0
- package/lib/typescript/dates/display/formatDateTimeForDisplay.d.ts +13 -0
- package/lib/typescript/dates/display/formatDateTimeForDisplay.d.ts.map +1 -0
- package/lib/typescript/dates/display/formatMonthForDisplay.d.ts +13 -0
- package/lib/typescript/dates/display/formatMonthForDisplay.d.ts.map +1 -0
- package/lib/typescript/dates/index.d.ts +58 -0
- package/lib/typescript/dates/index.d.ts.map +1 -0
- package/lib/typescript/dates/internal/brand.d.ts +11 -0
- package/lib/typescript/dates/internal/brand.d.ts.map +1 -0
- package/lib/typescript/dates/internal/calendarHelpers.d.ts +8 -0
- package/lib/typescript/dates/internal/calendarHelpers.d.ts.map +1 -0
- package/lib/typescript/dates/internal/clampHelpers.d.ts +5 -0
- package/lib/typescript/dates/internal/clampHelpers.d.ts.map +1 -0
- package/lib/typescript/dates/internal/dateIdToNativeDate.d.ts +12 -0
- package/lib/typescript/dates/internal/dateIdToNativeDate.d.ts.map +1 -0
- package/lib/typescript/dates/internal/intlCache.d.ts +12 -0
- package/lib/typescript/dates/internal/intlCache.d.ts.map +1 -0
- package/lib/typescript/dates/internal/intlCopy.d.ts +10 -0
- package/lib/typescript/dates/internal/intlCopy.d.ts.map +1 -0
- package/lib/typescript/dates/internal/segmentBuilders.d.ts +12 -0
- package/lib/typescript/dates/internal/segmentBuilders.d.ts.map +1 -0
- package/lib/typescript/dates/labels/dateComponentLabels.d.ts +31 -0
- package/lib/typescript/dates/labels/dateComponentLabels.d.ts.map +1 -0
- package/lib/typescript/dates/ranges/compareDateIds.d.ts +10 -0
- package/lib/typescript/dates/ranges/compareDateIds.d.ts.map +1 -0
- package/lib/typescript/dates/ranges/compareMonthIds.d.ts +10 -0
- package/lib/typescript/dates/ranges/compareMonthIds.d.ts.map +1 -0
- package/lib/typescript/dates/ranges/dateRangeAroundDay.d.ts +14 -0
- package/lib/typescript/dates/ranges/dateRangeAroundDay.d.ts.map +1 -0
- package/lib/typescript/dates/ranges/dateRangeFromLastNDays.d.ts +16 -0
- package/lib/typescript/dates/ranges/dateRangeFromLastNDays.d.ts.map +1 -0
- package/lib/typescript/dates/ranges/eachDateIdInRange.d.ts +10 -0
- package/lib/typescript/dates/ranges/eachDateIdInRange.d.ts.map +1 -0
- package/lib/typescript/dates/ranges/normalizeDateRange.d.ts +15 -0
- package/lib/typescript/dates/ranges/normalizeDateRange.d.ts.map +1 -0
- package/lib/typescript/dates/segments/applyDateSegmentChange.d.ts +21 -0
- package/lib/typescript/dates/segments/applyDateSegmentChange.d.ts.map +1 -0
- package/lib/typescript/dates/segments/formatDateSegment.d.ts +13 -0
- package/lib/typescript/dates/segments/formatDateSegment.d.ts.map +1 -0
- package/lib/typescript/dates/segments/getDateFieldSegments.d.ts +13 -0
- package/lib/typescript/dates/segments/getDateFieldSegments.d.ts.map +1 -0
- package/lib/typescript/dates/segments/getDateTimeFieldSegments.d.ts +14 -0
- package/lib/typescript/dates/segments/getDateTimeFieldSegments.d.ts.map +1 -0
- package/lib/typescript/dates/segments/getDateTimeSegmentVisibility.d.ts +8 -0
- package/lib/typescript/dates/segments/getDateTimeSegmentVisibility.d.ts.map +1 -0
- package/lib/typescript/dates/segments/getEmptyDateSegmentText.d.ts +9 -0
- package/lib/typescript/dates/segments/getEmptyDateSegmentText.d.ts.map +1 -0
- package/lib/typescript/dates/segments/parseDateSegment.d.ts +13 -0
- package/lib/typescript/dates/segments/parseDateSegment.d.ts.map +1 -0
- package/lib/typescript/dates/types.d.ts +66 -0
- package/lib/typescript/dates/types.d.ts.map +1 -0
- package/lib/typescript/dates/wire/clampDateParts.d.ts +12 -0
- package/lib/typescript/dates/wire/clampDateParts.d.ts.map +1 -0
- package/lib/typescript/dates/wire/clampMonthParts.d.ts +12 -0
- package/lib/typescript/dates/wire/clampMonthParts.d.ts.map +1 -0
- package/lib/typescript/dates/wire/dateId.d.ts +24 -0
- package/lib/typescript/dates/wire/dateId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/formatDateId.d.ts +12 -0
- package/lib/typescript/dates/wire/formatDateId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/formatMonthId.d.ts +12 -0
- package/lib/typescript/dates/wire/formatMonthId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/isValidDateId.d.ts +13 -0
- package/lib/typescript/dates/wire/isValidDateId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/isValidDateParts.d.ts +9 -0
- package/lib/typescript/dates/wire/isValidDateParts.d.ts.map +1 -0
- package/lib/typescript/dates/wire/isValidMonthId.d.ts +13 -0
- package/lib/typescript/dates/wire/isValidMonthId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/isValidMonthParts.d.ts +9 -0
- package/lib/typescript/dates/wire/isValidMonthParts.d.ts.map +1 -0
- package/lib/typescript/dates/wire/monthId.d.ts +22 -0
- package/lib/typescript/dates/wire/monthId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/parseDateId.d.ts +12 -0
- package/lib/typescript/dates/wire/parseDateId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/parseMonthId.d.ts +12 -0
- package/lib/typescript/dates/wire/parseMonthId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/toMonthId.d.ts +12 -0
- package/lib/typescript/dates/wire/toMonthId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/todayDateId.d.ts +8 -0
- package/lib/typescript/dates/wire/todayDateId.d.ts.map +1 -0
- package/lib/typescript/dates/wire/todayMonthId.d.ts +8 -0
- package/lib/typescript/dates/wire/todayMonthId.d.ts.map +1 -0
- package/lib/typescript/formatNumber.d.ts +19 -0
- package/lib/typescript/formatNumber.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/types.d.ts +2 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/lib/typescript/utils.d.ts +10 -0
- package/lib/typescript/utils.d.ts.map +1 -0
- package/package.json +50 -0
- package/src/__tests__/applyDateSegmentChange.test.ts +26 -0
- package/src/__tests__/calendarFormatters.test.ts +35 -0
- package/src/__tests__/clampDateParts.test.ts +16 -0
- package/src/__tests__/compareDateIds.test.ts +7 -0
- package/src/__tests__/compareMonthIds.test.ts +19 -0
- package/src/__tests__/dateComponentLabels.test.ts +25 -0
- package/src/__tests__/dateRangeAroundDay.test.ts +10 -0
- package/src/__tests__/dateRangeFromLastNDays.test.ts +8 -0
- package/src/__tests__/dateSegmentHelpers.test.ts +24 -0
- package/src/__tests__/datetimeHelpers.test.ts +65 -0
- package/src/__tests__/displayFormatters.test.ts +34 -0
- package/src/__tests__/eachDateIdInRange.test.ts +11 -0
- package/src/__tests__/formatCalendarMonthYear.test.ts +9 -0
- package/src/__tests__/formatDateForDisplay.test.ts +11 -0
- package/src/__tests__/formatDateId.test.ts +15 -0
- package/src/__tests__/formatMonthId.test.ts +7 -0
- package/src/__tests__/formatNumber.test.ts +35 -0
- package/src/__tests__/getDateFieldSegments.test.ts +35 -0
- package/src/__tests__/getDateTimeFieldSegments.test.ts +140 -0
- package/src/__tests__/getDateTimeSegmentVisibility.test.ts +12 -0
- package/src/__tests__/intlCopy.test.ts +64 -0
- package/src/__tests__/isValidDateId.test.ts +8 -0
- package/src/__tests__/isValidMonthId.test.ts +8 -0
- package/src/__tests__/normalizeDateRange.test.ts +10 -0
- package/src/__tests__/toMonthId.test.ts +7 -0
- package/src/__tests__/todayDateId.test.ts +7 -0
- package/src/__tests__/wireConstructors.test.ts +74 -0
- package/src/dates/calendar/formatCalendarMonthYear.ts +21 -0
- package/src/dates/calendar/formatDateTimeListDateRow.ts +41 -0
- package/src/dates/calendar/formatMonthCalendarMonth.ts +21 -0
- package/src/dates/calendar/formatMonthCalendarYear.ts +9 -0
- package/src/dates/calendar/getCalendarWeekdayLabels.ts +23 -0
- package/src/dates/datetime/clampDateTimeId.ts +25 -0
- package/src/dates/datetime/compareDateTimeIds.ts +23 -0
- package/src/dates/datetime/dateTimeId.ts +36 -0
- package/src/dates/datetime/formatDateTimeId.ts +35 -0
- package/src/dates/datetime/formatDateTimeListHour.ts +14 -0
- package/src/dates/datetime/formatDateTimeListMinute.ts +9 -0
- package/src/dates/datetime/formatDateTimeListPeriod.ts +12 -0
- package/src/dates/datetime/isLocaleHour12.ts +23 -0
- package/src/dates/datetime/isValidDateTimeId.ts +18 -0
- package/src/dates/datetime/nowDateTimeId.ts +53 -0
- package/src/dates/datetime/parseDateTimeId.ts +24 -0
- package/src/dates/display/formatDateForDisplay.ts +21 -0
- package/src/dates/display/formatDateRangeForDisplay.ts +23 -0
- package/src/dates/display/formatDateTimeForDisplay.ts +37 -0
- package/src/dates/display/formatMonthForDisplay.ts +26 -0
- package/src/dates/index.ts +86 -0
- package/src/dates/internal/brand.ts +11 -0
- package/src/dates/internal/calendarHelpers.ts +18 -0
- package/src/dates/internal/clampHelpers.ts +15 -0
- package/src/dates/internal/dateIdToNativeDate.ts +15 -0
- package/src/dates/internal/intlCache.ts +40 -0
- package/src/dates/internal/intlCopy.ts +75 -0
- package/src/dates/internal/segmentBuilders.ts +94 -0
- package/src/dates/labels/dateComponentLabels.ts +79 -0
- package/src/dates/ranges/compareDateIds.ts +21 -0
- package/src/dates/ranges/compareMonthIds.ts +26 -0
- package/src/dates/ranges/dateRangeAroundDay.ts +24 -0
- package/src/dates/ranges/dateRangeFromLastNDays.ts +26 -0
- package/src/dates/ranges/eachDateIdInRange.ts +21 -0
- package/src/dates/ranges/normalizeDateRange.ts +18 -0
- package/src/dates/segments/applyDateSegmentChange.ts +57 -0
- package/src/dates/segments/formatDateSegment.ts +18 -0
- package/src/dates/segments/getDateFieldSegments.ts +45 -0
- package/src/dates/segments/getDateTimeFieldSegments.ts +126 -0
- package/src/dates/segments/getDateTimeSegmentVisibility.ts +14 -0
- package/src/dates/segments/getEmptyDateSegmentText.ts +12 -0
- package/src/dates/segments/parseDateSegment.ts +25 -0
- package/src/dates/types.ts +80 -0
- package/src/dates/wire/clampDateParts.ts +17 -0
- package/src/dates/wire/clampMonthParts.ts +15 -0
- package/src/dates/wire/dateId.ts +44 -0
- package/src/dates/wire/formatDateId.ts +20 -0
- package/src/dates/wire/formatMonthId.ts +16 -0
- package/src/dates/wire/isValidDateId.ts +22 -0
- package/src/dates/wire/isValidDateParts.ts +17 -0
- package/src/dates/wire/isValidMonthId.ts +22 -0
- package/src/dates/wire/isValidMonthParts.ts +11 -0
- package/src/dates/wire/monthId.ts +42 -0
- package/src/dates/wire/parseDateId.ts +20 -0
- package/src/dates/wire/parseMonthId.ts +20 -0
- package/src/dates/wire/toMonthId.ts +17 -0
- package/src/dates/wire/todayDateId.ts +12 -0
- package/src/dates/wire/todayMonthId.ts +12 -0
- package/src/formatNumber.ts +56 -0
- package/src/index.ts +82 -0
- package/src/types.ts +1 -0
- package/src/utils.ts +29 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseDateId = parseDateId;
|
|
7
|
+
var _dateIdToNativeDate = require("../internal/dateIdToNativeDate");
|
|
8
|
+
var _isValidDateId = require("./isValidDateId");
|
|
9
|
+
/**
|
|
10
|
+
* Parses a wire `DateId` into numeric parts, or `null` when invalid.
|
|
11
|
+
*
|
|
12
|
+
* @param dateId - Wire date string (`YYYY-MM-DD`).
|
|
13
|
+
* @returns Parsed parts, or `null` when `dateId` is invalid.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* parseDateId('2026-07-28') // { year: 2026, month: 7, day: 28 }
|
|
17
|
+
*/
|
|
18
|
+
function parseDateId(dateId) {
|
|
19
|
+
if (!(0, _isValidDateId.isValidDateId)(dateId)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const date = (0, _dateIdToNativeDate.dateIdToNativeDate)(dateId);
|
|
23
|
+
return {
|
|
24
|
+
year: date.getFullYear(),
|
|
25
|
+
month: date.getMonth() + 1,
|
|
26
|
+
day: date.getDate()
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=parseDateId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dateIdToNativeDate","require","_isValidDateId","parseDateId","dateId","isValidDateId","date","dateIdToNativeDate","year","getFullYear","month","getMonth","day","getDate"],"sourceRoot":"../../../../src","sources":["dates/wire/parseDateId.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,WAAWA,CAACC,MAAc,EAAoB;EAC5D,IAAI,CAAC,IAAAC,4BAAa,EAACD,MAAM,CAAC,EAAE;IAC1B,OAAO,IAAI;EACb;EACA,MAAME,IAAI,GAAG,IAAAC,sCAAkB,EAACH,MAAM,CAAC;EACvC,OAAO;IAAEI,IAAI,EAAEF,IAAI,CAACG,WAAW,CAAC,CAAC;IAAEC,KAAK,EAAEJ,IAAI,CAACK,QAAQ,CAAC,CAAC,GAAG,CAAC;IAAEC,GAAG,EAAEN,IAAI,CAACO,OAAO,CAAC;EAAE,CAAC;AACtF","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseMonthId = parseMonthId;
|
|
7
|
+
var _dateIdToNativeDate = require("../internal/dateIdToNativeDate");
|
|
8
|
+
var _isValidMonthId = require("./isValidMonthId");
|
|
9
|
+
/**
|
|
10
|
+
* Parses a wire `MonthId` into numeric parts, or `null` when invalid.
|
|
11
|
+
*
|
|
12
|
+
* @param monthId - Wire month string (`YYYY-MM-01`).
|
|
13
|
+
* @returns Parsed parts, or `null` when `monthId` is invalid.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* parseMonthId('2026-07-01') // { year: 2026, month: 7 }
|
|
17
|
+
*/
|
|
18
|
+
function parseMonthId(monthId) {
|
|
19
|
+
if (!(0, _isValidMonthId.isValidMonthId)(monthId)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const date = (0, _dateIdToNativeDate.dateIdToNativeDate)(monthId);
|
|
23
|
+
return {
|
|
24
|
+
year: date.getFullYear(),
|
|
25
|
+
month: date.getMonth() + 1
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=parseMonthId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dateIdToNativeDate","require","_isValidMonthId","parseMonthId","monthId","isValidMonthId","date","dateIdToNativeDate","year","getFullYear","month","getMonth"],"sourceRoot":"../../../../src","sources":["dates/wire/parseMonthId.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,YAAYA,CAACC,OAAgB,EAAqB;EAChE,IAAI,CAAC,IAAAC,8BAAc,EAACD,OAAO,CAAC,EAAE;IAC5B,OAAO,IAAI;EACb;EACA,MAAME,IAAI,GAAG,IAAAC,sCAAkB,EAACH,OAAO,CAAC;EACxC,OAAO;IAAEI,IAAI,EAAEF,IAAI,CAACG,WAAW,CAAC,CAAC;IAAEC,KAAK,EAAEJ,IAAI,CAACK,QAAQ,CAAC,CAAC,GAAG;EAAE,CAAC;AACjE","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toMonthId = toMonthId;
|
|
7
|
+
var _dateFns = require("date-fns");
|
|
8
|
+
var _brand = require("../internal/brand");
|
|
9
|
+
var _dateIdToNativeDate = require("../internal/dateIdToNativeDate");
|
|
10
|
+
/**
|
|
11
|
+
* Truncates a `DateId` to its month wire id.
|
|
12
|
+
*
|
|
13
|
+
* @param dateId - Wire date string.
|
|
14
|
+
* @returns Wire `MonthId` for the same calendar month.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* toMonthId('2026-07-28') // '2026-07-01'
|
|
18
|
+
*/
|
|
19
|
+
function toMonthId(dateId) {
|
|
20
|
+
return (0, _brand.asMonthId)((0, _dateFns.format)((0, _dateFns.startOfMonth)((0, _dateIdToNativeDate.dateIdToNativeDate)(dateId)), 'yyyy-MM-dd'));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=toMonthId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dateFns","require","_brand","_dateIdToNativeDate","toMonthId","dateId","asMonthId","format","startOfMonth","dateIdToNativeDate"],"sourceRoot":"../../../../src","sources":["dates/wire/toMonthId.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,SAASA,CAACC,MAAc,EAAW;EACjD,OAAO,IAAAC,gBAAS,EAAC,IAAAC,eAAM,EAAC,IAAAC,qBAAY,EAAC,IAAAC,sCAAkB,EAACJ,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAClF","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.todayDateId = todayDateId;
|
|
7
|
+
var _dateFns = require("date-fns");
|
|
8
|
+
var _brand = require("../internal/brand");
|
|
9
|
+
/**
|
|
10
|
+
* Returns the device-local calendar date as a wire `DateId`.
|
|
11
|
+
*
|
|
12
|
+
* @returns Today's date as `YYYY-MM-DD`.
|
|
13
|
+
*/
|
|
14
|
+
function todayDateId() {
|
|
15
|
+
return (0, _brand.asDateId)((0, _dateFns.format)(new Date(), 'yyyy-MM-dd'));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=todayDateId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dateFns","require","_brand","todayDateId","asDateId","format","Date"],"sourceRoot":"../../../../src","sources":["dates/wire/todayDateId.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACO,SAASE,WAAWA,CAAA,EAAW;EACpC,OAAO,IAAAC,eAAQ,EAAC,IAAAC,eAAM,EAAC,IAAIC,IAAI,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AACnD","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.todayMonthId = todayMonthId;
|
|
7
|
+
var _dateFns = require("date-fns");
|
|
8
|
+
var _brand = require("../internal/brand");
|
|
9
|
+
/**
|
|
10
|
+
* Returns the device-local calendar month as a wire `MonthId`.
|
|
11
|
+
*
|
|
12
|
+
* @returns Current month as `YYYY-MM-01`.
|
|
13
|
+
*/
|
|
14
|
+
function todayMonthId() {
|
|
15
|
+
return (0, _brand.asMonthId)((0, _dateFns.format)((0, _dateFns.startOfMonth)(new Date()), 'yyyy-MM-dd'));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=todayMonthId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dateFns","require","_brand","todayMonthId","asMonthId","format","startOfMonth","Date"],"sourceRoot":"../../../../src","sources":["dates/wire/todayMonthId.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAGA;AACA;AACA;AACA;AACA;AACO,SAASE,YAAYA,CAAA,EAAY;EACtC,OAAO,IAAAC,gBAAS,EAAC,IAAAC,eAAM,EAAC,IAAAC,qBAAY,EAAC,IAAIC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;AAClE","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formatNumber = formatNumber;
|
|
7
|
+
var _utils = require("./utils");
|
|
8
|
+
const formatterCache = new Map();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Cache NumberFormat by locale/fraction digits.
|
|
12
|
+
* Constructing Intl formatters is expensive on RN/Hermes; reuse the instance and only call `.format`.
|
|
13
|
+
*/
|
|
14
|
+
function getDecimalFormatter(locale, decimalPlaces) {
|
|
15
|
+
const key = `${String(locale)}|${String(decimalPlaces)}`;
|
|
16
|
+
let formatter = formatterCache.get(key);
|
|
17
|
+
if (!formatter) {
|
|
18
|
+
formatter = new Intl.NumberFormat(locale, {
|
|
19
|
+
style: 'decimal',
|
|
20
|
+
notation: 'standard',
|
|
21
|
+
minimumFractionDigits: decimalPlaces,
|
|
22
|
+
maximumFractionDigits: decimalPlaces
|
|
23
|
+
});
|
|
24
|
+
formatterCache.set(key, formatter);
|
|
25
|
+
}
|
|
26
|
+
return formatter;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Formats a value as a number with decimal places for display.
|
|
31
|
+
*
|
|
32
|
+
* @param value - Value to format (`number`, plain numeric `string` like `'1234.56'`, `null`, or `undefined`).
|
|
33
|
+
* @param options - Formatting options.
|
|
34
|
+
* @param options.locale - BCP 47 locale; defaults to `en-US`.
|
|
35
|
+
* @param options.decimalPlaces - Fraction digits; defaults to `2`.
|
|
36
|
+
* @returns Locale-formatted decimal string, or `''` for nullish, blank, or non-numeric values.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* formatNumber(3247.19) // '3,247.19'
|
|
40
|
+
*/
|
|
41
|
+
function formatNumber(value, options) {
|
|
42
|
+
const locale = options?.locale ?? 'en-US';
|
|
43
|
+
const decimalPlaces = options?.decimalPlaces ?? 2;
|
|
44
|
+
const number = (0, _utils.toFiniteNumber)(value);
|
|
45
|
+
if (number == null) {
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
return getDecimalFormatter(locale, decimalPlaces).format(number);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=formatNumber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_utils","require","formatterCache","Map","getDecimalFormatter","locale","decimalPlaces","key","String","formatter","get","Intl","NumberFormat","style","notation","minimumFractionDigits","maximumFractionDigits","set","formatNumber","value","options","number","toFiniteNumber","format"],"sourceRoot":"../../src","sources":["formatNumber.ts"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAOA,MAAMC,cAAc,GAAG,IAAIC,GAAG,CAA4B,CAAC;;AAE3D;AACA;AACA;AACA;AACA,SAASC,mBAAmBA,CAC1BC,MAA4B,EAC5BC,aAAqB,EACF;EACnB,MAAMC,GAAG,GAAG,GAAGC,MAAM,CAACH,MAAM,CAAC,IAAIG,MAAM,CAACF,aAAa,CAAC,EAAE;EACxD,IAAIG,SAAS,GAAGP,cAAc,CAACQ,GAAG,CAACH,GAAG,CAAC;EACvC,IAAI,CAACE,SAAS,EAAE;IACdA,SAAS,GAAG,IAAIE,IAAI,CAACC,YAAY,CAACP,MAAM,EAAE;MACxCQ,KAAK,EAAE,SAAS;MAChBC,QAAQ,EAAE,UAAU;MACpBC,qBAAqB,EAAET,aAAa;MACpCU,qBAAqB,EAAEV;IACzB,CAAC,CAAC;IACFJ,cAAc,CAACe,GAAG,CAACV,GAAG,EAAEE,SAAS,CAAC;EACpC;EACA,OAAOA,SAAS;AAClB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASS,YAAYA,CAC1BC,KAAgC,EAChCC,OAAuC,EAC/B;EACR,MAAMf,MAAM,GAAGe,OAAO,EAAEf,MAAM,IAAI,OAAO;EACzC,MAAMC,aAAa,GAAGc,OAAO,EAAEd,aAAa,IAAI,CAAC;EACjD,MAAMe,MAAM,GAAG,IAAAC,qBAAc,EAACH,KAAK,CAAC;EACpC,IAAIE,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,EAAE;EACX;EACA,OAAOjB,mBAAmB,CAACC,MAAM,EAAEC,aAAa,CAAC,CAACiB,MAAM,CAACF,MAAM,CAAC;AAClE","ignoreList":[]}
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "DEFAULT_DATE_COMPONENT_LABELS", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _dates.DEFAULT_DATE_COMPONENT_LABELS;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "applyDateSegmentChange", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _dates.applyDateSegmentChange;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "clampDateParts", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _dates.clampDateParts;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "clampDateTimeId", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _dates.clampDateTimeId;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "clampMonthParts", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _dates.clampMonthParts;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "compareDateIds", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _dates.compareDateIds;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "compareDateTimeIds", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _dates.compareDateTimeIds;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "compareMonthIds", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _dates.compareMonthIds;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "dateId", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _dates.dateId;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "dateRangeAroundDay", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _dates.dateRangeAroundDay;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "dateRangeFromLastNDays", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _dates.dateRangeFromLastNDays;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "dateTimeId", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _dates.dateTimeId;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "eachDateIdInRange", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _dates.eachDateIdInRange;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "formatCalendarMonthYear", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _dates.formatCalendarMonthYear;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "formatDateForDisplay", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _dates.formatDateForDisplay;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "formatDateId", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _dates.formatDateId;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "formatDateRangeForDisplay", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _dates.formatDateRangeForDisplay;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "formatDateSegment", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _dates.formatDateSegment;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "formatDateTimeForDisplay", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _dates.formatDateTimeForDisplay;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "formatDateTimeId", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _dates.formatDateTimeId;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "formatDateTimeListDateRow", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () {
|
|
129
|
+
return _dates.formatDateTimeListDateRow;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "formatDateTimeListHour", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _dates.formatDateTimeListHour;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "formatDateTimeListMinute", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () {
|
|
141
|
+
return _dates.formatDateTimeListMinute;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "formatDateTimeListPeriod", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _dates.formatDateTimeListPeriod;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "formatMonthCalendarMonth", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _dates.formatMonthCalendarMonth;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "formatMonthCalendarYear", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _dates.formatMonthCalendarYear;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "formatMonthForDisplay", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () {
|
|
165
|
+
return _dates.formatMonthForDisplay;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "formatMonthId", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _dates.formatMonthId;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "formatNumber", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () {
|
|
177
|
+
return _formatNumber.formatNumber;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "formatSelectYear", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () {
|
|
183
|
+
return _dates.formatSelectYear;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "getCalendarWeekdayLabels", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _dates.getCalendarWeekdayLabels;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(exports, "getDateFieldSegments", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: function () {
|
|
195
|
+
return _dates.getDateFieldSegments;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "getDateSegmentAccessibilityLabel", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () {
|
|
201
|
+
return _dates.getDateSegmentAccessibilityLabel;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
Object.defineProperty(exports, "getDateTimeFieldSegments", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function () {
|
|
207
|
+
return _dates.getDateTimeFieldSegments;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "getDateTimeSegmentVisibility", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function () {
|
|
213
|
+
return _dates.getDateTimeSegmentVisibility;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(exports, "getEmptyDateSegmentText", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return _dates.getEmptyDateSegmentText;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, "isLocaleHour12", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () {
|
|
225
|
+
return _dates.isLocaleHour12;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
Object.defineProperty(exports, "isValidDateId", {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
get: function () {
|
|
231
|
+
return _dates.isValidDateId;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(exports, "isValidDateParts", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function () {
|
|
237
|
+
return _dates.isValidDateParts;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
Object.defineProperty(exports, "isValidDateTimeId", {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
get: function () {
|
|
243
|
+
return _dates.isValidDateTimeId;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, "isValidMonthId", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function () {
|
|
249
|
+
return _dates.isValidMonthId;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
Object.defineProperty(exports, "isValidMonthParts", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function () {
|
|
255
|
+
return _dates.isValidMonthParts;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
Object.defineProperty(exports, "monthId", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function () {
|
|
261
|
+
return _dates.monthId;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(exports, "normalizeDateRange", {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
get: function () {
|
|
267
|
+
return _dates.normalizeDateRange;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
Object.defineProperty(exports, "nowDateTimeId", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function () {
|
|
273
|
+
return _dates.nowDateTimeId;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
Object.defineProperty(exports, "parseDateId", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () {
|
|
279
|
+
return _dates.parseDateId;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, "parseDateSegment", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () {
|
|
285
|
+
return _dates.parseDateSegment;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
Object.defineProperty(exports, "parseDateTimeId", {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function () {
|
|
291
|
+
return _dates.parseDateTimeId;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
Object.defineProperty(exports, "parseMonthId", {
|
|
295
|
+
enumerable: true,
|
|
296
|
+
get: function () {
|
|
297
|
+
return _dates.parseMonthId;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
Object.defineProperty(exports, "resolveDateComponentLabels", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _dates.resolveDateComponentLabels;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(exports, "toMonthId", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function () {
|
|
309
|
+
return _dates.toMonthId;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
Object.defineProperty(exports, "todayDateId", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
get: function () {
|
|
315
|
+
return _dates.todayDateId;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
Object.defineProperty(exports, "todayMonthId", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function () {
|
|
321
|
+
return _dates.todayMonthId;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
var _formatNumber = require("./formatNumber");
|
|
325
|
+
var _dates = require("./dates");
|
|
326
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_formatNumber","require","_dates"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAoBA,IAAAC,MAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toFiniteNumber = toFiniteNumber;
|
|
7
|
+
/**
|
|
8
|
+
* Coerce a nullable number/string to a finite number for display formatters.
|
|
9
|
+
*
|
|
10
|
+
* Hermes does not support the `signDisplay` property on iOS (and is unreliable on Android 11),
|
|
11
|
+
* so `-0` can still format as `"-0.00"`. Normalize before Intl to avoid this issue.
|
|
12
|
+
* @see https://github.com/facebook/hermes/blob/main/doc/IntlAPIs.md#limited-ios-property-support
|
|
13
|
+
*/
|
|
14
|
+
function toFiniteNumber(value) {
|
|
15
|
+
if (value == null) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
let number;
|
|
19
|
+
if (typeof value === 'string') {
|
|
20
|
+
const trimmed = value.trim();
|
|
21
|
+
if (!trimmed) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
number = Number(trimmed);
|
|
25
|
+
} else {
|
|
26
|
+
number = value;
|
|
27
|
+
}
|
|
28
|
+
if (Number.isNaN(number)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return Object.is(number, -0) ? 0 : number;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["toFiniteNumber","value","undefined","number","trimmed","trim","Number","isNaN","Object","is"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAcA,CAACC,KAAgC,EAAsB;EACnF,IAAIA,KAAK,IAAI,IAAI,EAAE;IACjB,OAAOC,SAAS;EAClB;EACA,IAAIC,MAAc;EAClB,IAAI,OAAOF,KAAK,KAAK,QAAQ,EAAE;IAC7B,MAAMG,OAAO,GAAGH,KAAK,CAACI,IAAI,CAAC,CAAC;IAC5B,IAAI,CAACD,OAAO,EAAE;MACZ,OAAOF,SAAS;IAClB;IACAC,MAAM,GAAGG,MAAM,CAACF,OAAO,CAAC;EAC1B,CAAC,MAAM;IACLD,MAAM,GAAGF,KAAK;EAChB;EACA,IAAIK,MAAM,CAACC,KAAK,CAACJ,MAAM,CAAC,EAAE;IACxB,OAAOD,SAAS;EAClB;EAEA,OAAOM,MAAM,CAACC,EAAE,CAACN,MAAM,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAGA,MAAM;AAC3C","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { dateIdToNativeDate } from '../internal/dateIdToNativeDate';
|
|
4
|
+
import { getCachedDateFormatter } from '../internal/intlCache';
|
|
5
|
+
/**
|
|
6
|
+
* Formats a calendar header label, e.g. `July 2026`.
|
|
7
|
+
*
|
|
8
|
+
* Uses `Intl` so `options.locale` is respected (same pattern as display formatters).
|
|
9
|
+
*
|
|
10
|
+
* @param monthId - Wire month string (`YYYY-MM-01`).
|
|
11
|
+
* @param options - Locale and optional time zone.
|
|
12
|
+
* @returns Long month and year label.
|
|
13
|
+
*/
|
|
14
|
+
export function formatCalendarMonthYear(monthId, options) {
|
|
15
|
+
const formatter = getCachedDateFormatter(options?.locale ?? 'en-US', {
|
|
16
|
+
month: 'long',
|
|
17
|
+
year: 'numeric',
|
|
18
|
+
...(options?.timeZone ? {
|
|
19
|
+
timeZone: options.timeZone
|
|
20
|
+
} : {})
|
|
21
|
+
});
|
|
22
|
+
return formatter.format(dateIdToNativeDate(monthId));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=formatCalendarMonthYear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["dateIdToNativeDate","getCachedDateFormatter","formatCalendarMonthYear","monthId","options","formatter","locale","month","year","timeZone","format"],"sourceRoot":"../../../../src","sources":["dates/calendar/formatCalendarMonthYear.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,sBAAsB,QAAQ,uBAAuB;AAG9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,OAAgB,EAAEC,OAA2B,EAAU;EAC7F,MAAMC,SAAS,GAAGJ,sBAAsB,CAACG,OAAO,EAAEE,MAAM,IAAI,OAAO,EAAE;IACnEC,KAAK,EAAE,MAAM;IACbC,IAAI,EAAE,SAAS;IACf,IAAIJ,OAAO,EAAEK,QAAQ,GAAG;MAAEA,QAAQ,EAAEL,OAAO,CAACK;IAAS,CAAC,GAAG,CAAC,CAAC;EAC7D,CAAC,CAAC;EACF,OAAOJ,SAAS,CAACK,MAAM,CAACV,kBAAkB,CAACG,OAAO,CAAC,CAAC;AACtD","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { dateIdToNativeDate } from '../internal/dateIdToNativeDate';
|
|
4
|
+
import { formatRelativeToday } from '../internal/intlCopy';
|
|
5
|
+
import { getCachedDateFormatter } from '../internal/intlCache';
|
|
6
|
+
/**
|
|
7
|
+
* Formats a row label for a scrollable date list. Returns a locale-aware "today" label when the
|
|
8
|
+
* id matches today (pass a precomputed `todayDateId` when comparing wire ids).
|
|
9
|
+
*
|
|
10
|
+
* @param dateId - Wire date string.
|
|
11
|
+
* @param options - Locale, optional `todayDateId` override, and time zone.
|
|
12
|
+
* @returns Relative today label or a short weekday/month/day label.
|
|
13
|
+
*/
|
|
14
|
+
export function formatDateTimeListDateRow(dateId, options) {
|
|
15
|
+
const locale = options?.locale ?? 'en-US';
|
|
16
|
+
const todayId = options?.todayDateId;
|
|
17
|
+
if (todayId && dateId === todayId) {
|
|
18
|
+
return formatRelativeToday(locale);
|
|
19
|
+
}
|
|
20
|
+
const date = dateIdToNativeDate(dateId);
|
|
21
|
+
const todayParts = new Date();
|
|
22
|
+
const isToday = date.getFullYear() === todayParts.getFullYear() && date.getMonth() === todayParts.getMonth() && date.getDate() === todayParts.getDate();
|
|
23
|
+
if (isToday) {
|
|
24
|
+
return formatRelativeToday(locale);
|
|
25
|
+
}
|
|
26
|
+
const formatter = getCachedDateFormatter(locale, {
|
|
27
|
+
weekday: 'short',
|
|
28
|
+
month: 'short',
|
|
29
|
+
day: 'numeric',
|
|
30
|
+
...(options?.timeZone ? {
|
|
31
|
+
timeZone: options.timeZone
|
|
32
|
+
} : {})
|
|
33
|
+
});
|
|
34
|
+
return formatter.format(date);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=formatDateTimeListDateRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["dateIdToNativeDate","formatRelativeToday","getCachedDateFormatter","formatDateTimeListDateRow","dateId","options","locale","todayId","todayDateId","date","todayParts","Date","isToday","getFullYear","getMonth","getDate","formatter","weekday","month","day","timeZone","format"],"sourceRoot":"../../../../src","sources":["dates/calendar/formatDateTimeListDateRow.ts"],"mappings":";;AAAA,SAASA,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASC,sBAAsB,QAAQ,uBAAuB;AAG9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,yBAAyBA,CACvCC,MAAc,EACdC,OAAsD,EAC9C;EACR,MAAMC,MAAM,GAAGD,OAAO,EAAEC,MAAM,IAAI,OAAO;EACzC,MAAMC,OAAO,GAAGF,OAAO,EAAEG,WAAW;EACpC,IAAID,OAAO,IAAIH,MAAM,KAAKG,OAAO,EAAE;IACjC,OAAON,mBAAmB,CAACK,MAAM,CAAC;EACpC;EAEA,MAAMG,IAAI,GAAGT,kBAAkB,CAACI,MAAM,CAAC;EACvC,MAAMM,UAAU,GAAG,IAAIC,IAAI,CAAC,CAAC;EAC7B,MAAMC,OAAO,GACXH,IAAI,CAACI,WAAW,CAAC,CAAC,KAAKH,UAAU,CAACG,WAAW,CAAC,CAAC,IAC/CJ,IAAI,CAACK,QAAQ,CAAC,CAAC,KAAKJ,UAAU,CAACI,QAAQ,CAAC,CAAC,IACzCL,IAAI,CAACM,OAAO,CAAC,CAAC,KAAKL,UAAU,CAACK,OAAO,CAAC,CAAC;EACzC,IAAIH,OAAO,EAAE;IACX,OAAOX,mBAAmB,CAACK,MAAM,CAAC;EACpC;EAEA,MAAMU,SAAS,GAAGd,sBAAsB,CAACI,MAAM,EAAE;IAC/CW,OAAO,EAAE,OAAO;IAChBC,KAAK,EAAE,OAAO;IACdC,GAAG,EAAE,SAAS;IACd,IAAId,OAAO,EAAEe,QAAQ,GAAG;MAAEA,QAAQ,EAAEf,OAAO,CAACe;IAAS,CAAC,GAAG,CAAC,CAAC;EAC7D,CAAC,CAAC;EACF,OAAOJ,SAAS,CAACK,MAAM,CAACZ,IAAI,CAAC;AAC/B","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getCachedDateFormatter } from '../internal/intlCache';
|
|
4
|
+
/**
|
|
5
|
+
* Formats a short month name for month-grid cells (1–12).
|
|
6
|
+
*
|
|
7
|
+
* @param month - Month number (1–12).
|
|
8
|
+
* @param options - Locale and optional time zone.
|
|
9
|
+
* @returns Short month name.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* formatMonthCalendarMonth(7, { locale: 'en-US' }) // 'Jul'
|
|
13
|
+
*/
|
|
14
|
+
export function formatMonthCalendarMonth(month, options) {
|
|
15
|
+
const date = new Date(2024, month - 1, 1);
|
|
16
|
+
const formatter = getCachedDateFormatter(options?.locale ?? 'en-US', {
|
|
17
|
+
month: 'short',
|
|
18
|
+
...(options?.timeZone ? {
|
|
19
|
+
timeZone: options.timeZone
|
|
20
|
+
} : {})
|
|
21
|
+
});
|
|
22
|
+
return formatter.format(date);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=formatMonthCalendarMonth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getCachedDateFormatter","formatMonthCalendarMonth","month","options","date","Date","formatter","locale","timeZone","format"],"sourceRoot":"../../../../src","sources":["dates/calendar/formatMonthCalendarMonth.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,uBAAuB;AAG9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAACC,KAAa,EAAEC,OAA2B,EAAU;EAC3F,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAAC,IAAI,EAAEH,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;EACzC,MAAMI,SAAS,GAAGN,sBAAsB,CAACG,OAAO,EAAEI,MAAM,IAAI,OAAO,EAAE;IACnEL,KAAK,EAAE,OAAO;IACd,IAAIC,OAAO,EAAEK,QAAQ,GAAG;MAAEA,QAAQ,EAAEL,OAAO,CAACK;IAAS,CAAC,GAAG,CAAC,CAAC;EAC7D,CAAC,CAAC;EACF,OAAOF,SAAS,CAACG,MAAM,CAACL,IAAI,CAAC;AAC/B","ignoreList":[]}
|