ts-time-utils 4.1.0 → 4.4.0
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 +81 -31
- package/dist/{age.js → age.cjs} +14 -6
- package/dist/{calculate.js → calculate.cjs} +30 -18
- package/dist/{calendar.js → calendar.cjs} +80 -39
- package/dist/{calendars.js → calendars.cjs} +48 -23
- package/dist/{chain.js → chain.cjs} +41 -40
- package/dist/{compare.js → compare.cjs} +58 -28
- package/dist/constants.cjs +19 -0
- package/dist/{countdown.js → countdown.cjs} +16 -7
- package/dist/{cron.js → cron.cjs} +20 -9
- package/dist/{dateRange.js → dateRange.cjs} +42 -26
- package/dist/{duration.js → duration.cjs} +56 -44
- package/dist/esm/chain.js +0 -5
- package/dist/esm/naturalLanguage.d.ts +1 -3
- package/dist/esm/naturalLanguage.d.ts.map +1 -1
- package/dist/esm/naturalLanguage.js +9 -2
- package/dist/esm/plugins.d.ts +0 -6
- package/dist/esm/plugins.d.ts.map +1 -1
- package/dist/esm/plugins.js +36 -42
- package/dist/esm/recurrence.d.ts.map +1 -1
- package/dist/esm/recurrence.js +3 -5
- package/dist/esm/timezone.d.ts +6 -1
- package/dist/esm/timezone.d.ts.map +1 -1
- package/dist/esm/timezone.js +106 -66
- package/dist/esm/types.d.ts +0 -4
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/{finance.js → finance.cjs} +39 -22
- package/dist/{fiscal.js → fiscal.cjs} +36 -17
- package/dist/{format.js → format.cjs} +83 -70
- package/dist/{healthcare.js → healthcare.cjs} +37 -22
- package/dist/{holidays.js → holidays.cjs} +52 -25
- package/dist/index.cjs +595 -0
- package/dist/{interval.js → interval.cjs} +24 -11
- package/dist/{iterate.js → iterate.cjs} +84 -41
- package/dist/{locale.js → locale.cjs} +54 -26
- package/dist/{naturalLanguage.js → naturalLanguage.cjs} +36 -23
- package/dist/naturalLanguage.d.ts +1 -3
- package/dist/naturalLanguage.d.ts.map +1 -1
- package/dist/{parse.js → parse.cjs} +24 -11
- package/dist/{performance.js → performance.cjs} +23 -10
- package/dist/{plugins.js → plugins.cjs} +48 -47
- package/dist/plugins.d.ts +0 -6
- package/dist/plugins.d.ts.map +1 -1
- package/dist/{precision.js → precision.cjs} +74 -37
- package/dist/{rangePresets.js → rangePresets.cjs} +40 -19
- package/dist/{recurrence.js → recurrence.cjs} +27 -21
- package/dist/recurrence.d.ts.map +1 -1
- package/dist/{scheduling.js → scheduling.cjs} +46 -31
- package/dist/{serialize.js → serialize.cjs} +36 -17
- package/dist/{temporal.js → temporal.cjs} +28 -13
- package/dist/{timezone.js → timezone.cjs} +140 -82
- package/dist/timezone.d.ts +6 -1
- package/dist/timezone.d.ts.map +1 -1
- package/dist/{types.js → types.cjs} +9 -3
- package/dist/types.d.ts +0 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/{validate.js → validate.cjs} +54 -26
- package/dist/{workingHours.js → workingHours.cjs} +36 -17
- package/package.json +40 -37
- package/dist/constants.js +0 -16
- package/dist/index.js +0 -72
package/dist/index.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Main entry point for ts-time-utils library
|
|
3
|
-
* Re-exports all functions from individual modules for convenience
|
|
4
|
-
*/
|
|
5
|
-
// Format utilities
|
|
6
|
-
export { formatDuration, timeAgo, formatTime, parseDuration, formatDate, formatDateRange, formatOrdinal, formatDayOrdinal, formatDurationCompact, formatCalendarDate } from './format.js';
|
|
7
|
-
// Calculation utilities
|
|
8
|
-
export { differenceInUnits, addTime, subtractTime, startOf, endOf, isBetween, businessDaysBetween, roundToNearestUnit, ceilDate, floorDate } from './calculate.js';
|
|
9
|
-
// Validation utilities
|
|
10
|
-
export { isValidDate, isLeapYear, isPast, isFuture, isToday, isYesterday, isTomorrow, isSameDay, isSameWeek, isSameMonth, isSameYear, isThisWeek, isThisMonth, isThisYear, isWeekend, isWeekday, isBusinessDay, isInLastNDays, isInNextNDays, isValidTimeString, isValidISOString, isSameHour, isSameMinute, isSameSecond, isInQuarter, isSameQuarter } from './validate.js';
|
|
11
|
-
// Age utilities
|
|
12
|
-
export { calculateAge, getAgeInUnits, getLifeStage, getNextBirthday, getDaysUntilBirthday, isBirthday } from './age.js';
|
|
13
|
-
// Calendar utilities
|
|
14
|
-
export { getWeekNumber, getWeekOfMonth, getQuarter, getDayOfYear, getWeeksInYear, getDaysInMonth, getDaysInYear, getEaster, getMonthsInYear, getDaysInMonthArray, getWeekdaysInMonth, getFirstDayOfMonth, getLastDayOfMonth, getFirstDayOfYear, getLastDayOfYear, getNthDayOfMonth, getNewYearsDay, getMLKDay, getPresidentsDay, getMemorialDay, getIndependenceDay, getLaborDay, getColumbusDay, getVeteransDay, getThanksgivingDay, getChristmasDay, getGoodFriday, getUSHolidays, isUSHoliday, getUSHolidayName, getStartOfWeek, getEndOfWeek, getWeeksInMonth, getWeekYear, lastDayOfDecade, firstDayOfDecade, lastDayOfCentury, getStartOfQuarter, getEndOfQuarter } from './calendar.js';
|
|
15
|
-
// Parse utilities
|
|
16
|
-
export { parseDate, parseRelativeDate, parseTimeAgo, parseCustomFormat, parseManyFormats, parseISO8601Duration, parseISO8601DurationToMs, parseTime, guessDateFormat, parseAutoFormat, parseRangeEndpoint } from './parse.js';
|
|
17
|
-
// Performance utilities
|
|
18
|
-
export { sleep, timeout, debounce, throttle, retry, createStopwatch, measureTime, measureAsync, benchmark, Stopwatch } from './performance.js';
|
|
19
|
-
// Interval utilities
|
|
20
|
-
export { createInterval, isValidInterval, intervalDuration, intervalContains, intervalsOverlap, intervalIntersection, mergeIntervals, subtractInterval, splitIntervalByDay, totalIntervalCoverage, normalizeIntervals } from './interval.js';
|
|
21
|
-
// Timezone utilities
|
|
22
|
-
export { getTimezoneOffset, formatInTimeZone, getZonedTime, convertDateToZone, isValidTimeZone, COMMON_TIMEZONES, getLocalOffset, compareZoneOffsets, reinterpretAsZone, isDST, getNextDSTTransition, findCommonWorkingHours, getTimezoneAbbreviation, convertBetweenZones, getTimezoneDifferenceHours, isSameTimezone } from './timezone.js';
|
|
23
|
-
// Working hours utilities
|
|
24
|
-
export { DEFAULT_WORKING_HOURS, isWorkingDay, isWorkingTime, nextWorkingTime, workingTimeBetween, addWorkingHours, addWorkingDays, subtractWorkingDays, getNextWorkingDay, getPreviousWorkingDay, getWorkingDaysInMonth, getWorkingDaysInMonthArray, workingDaysBetween, isBreakTime, getWorkDayStart, getWorkDayEnd, getWorkingHoursPerDay } from './workingHours.js';
|
|
25
|
-
// Range preset utilities
|
|
26
|
-
export { today, yesterday, tomorrow, lastNDays, nextNDays, thisWeek, lastWeek, nextWeek, thisMonth, lastMonth, nextMonth, thisYear, lastYear, nextYear, rollingWindowDays, quarterRange, lastQuarter, nextQuarter, RANGE_PRESETS } from './rangePresets.js';
|
|
27
|
-
// Duration utilities
|
|
28
|
-
export { Duration, createDuration, isValidDuration, parseDurationString, formatDurationString, maxDuration, minDuration, sumDurations, averageDuration } from './duration.js';
|
|
29
|
-
// Serialization utilities
|
|
30
|
-
export { serializeDate, deserializeDate, createDateReviver, createDateReplacer, parseISOString, toEpochTimestamp, fromEpochTimestamp, createEpochTimestamp, toDateObject, fromDateObject, isValidISODateString, isValidEpochTimestamp, cloneDate, datesEqual, now, parseJSONWithDates, stringifyWithDates } from './serialize.js';
|
|
31
|
-
// Locale utilities
|
|
32
|
-
export { registerLocale, getLocaleConfig, getSupportedLocales, formatRelativeTime, formatDateLocale, formatTimeLocale, formatDateTimeLocale, getMonthNames, getDayNames, getFirstDayOfWeek, isLocaleSupported, getBestMatchingLocale, detectLocale,
|
|
33
|
-
// Conversion utilities
|
|
34
|
-
convertRelativeTime, detectLocaleFromRelativeTime, convertFormatPattern, convertFormattedDate, convertRelativeTimeArray, compareLocaleFormats,
|
|
35
|
-
// Week info utilities
|
|
36
|
-
getWeekInfo, getLocaleWeekStartsOn, getLocaleWeekendDays, intlFormat, formatISODate, formatISOTime, formatDistanceStrict } from './locale.js';
|
|
37
|
-
// Recurrence utilities
|
|
38
|
-
export { createRecurrence, getNextOccurrence, getOccurrencesBetween, isRecurrenceDate, isValidRecurrenceRule, recurrenceToString } from './recurrence.js';
|
|
39
|
-
// Countdown utilities
|
|
40
|
-
export { createCountdown, getRemainingTime, formatCountdown, isExpired, getProgressPercentage, getTimeUntil, createDeadline } from './countdown.js';
|
|
41
|
-
// Date range utilities
|
|
42
|
-
export { dateRangeOverlap, hasOverlappingRanges, mergeDateRanges, findGaps, splitRange, containsDate, getIntersection, getUnion, subtractRange, getRangeDuration, expandRange, shrinkRange, rangeContains, sortRanges } from './dateRange.js';
|
|
43
|
-
// Natural language parsing utilities
|
|
44
|
-
export { parseNaturalDate, parseRelativePhrase, extractDatesFromText, suggestDateFromContext } from './naturalLanguage.js';
|
|
45
|
-
// Constants and types
|
|
46
|
-
export { MILLISECONDS_PER_SECOND, MILLISECONDS_PER_MINUTE, MILLISECONDS_PER_HOUR, MILLISECONDS_PER_DAY, MILLISECONDS_PER_WEEK, MILLISECONDS_PER_MONTH, MILLISECONDS_PER_YEAR, SECONDS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK } from './constants.js';
|
|
47
|
-
// Cron expression utilities
|
|
48
|
-
export { parseCronExpression, parseCronField, matchesCron, getNextCronDate, getNextCronDates, getPreviousCronDate, isValidCron, describeCron, CRON_PRESETS } from './cron.js';
|
|
49
|
-
// Fiscal year utilities
|
|
50
|
-
export { getFiscalYear, getFiscalQuarter, getFiscalYearStart, getFiscalYearEnd, getFiscalQuarterStart, getFiscalQuarterEnd, isSameFiscalYear, isSameFiscalQuarter, getFiscalMonth, getDaysRemainingInFiscalYear, getDaysElapsedInFiscalYear, getFiscalYearProgress, getFiscalWeek, formatFiscalYear, formatFiscalQuarter, getFiscalPeriodInfo, FISCAL_PRESETS } from './fiscal.js';
|
|
51
|
-
// Date comparison and sorting utilities
|
|
52
|
-
export { compareDates, compareDatesDesc, sortDates, minDate, maxDate, dateExtent, uniqueDates, closestDate, closestFutureDate, closestPastDate, clampDate, isDateInRange, filterDatesInRange, groupDates, groupDatesByYear, groupDatesByMonth, groupDatesByDay, groupDatesByDayOfWeek, medianDate, averageDate, roundDate, snapDate, isChronological, dateSpan, partitionDates, nthDate, closestIndexTo, getOverlappingDaysInIntervals } from './compare.js';
|
|
53
|
-
// Date iteration utilities
|
|
54
|
-
export { eachDay, eachWeekday, eachWeekend, eachWeek, eachMonth, eachQuarter, eachYear, eachHour, eachMinute, eachDayOfWeek, eachInterval, countDays, countWeekdays, countWeekendDays, countWeeks, countMonths, iterateDates, iterateDays, iterateWeekdays, iterateMonths, filterDays, eachMonthEnd, eachNthDayOfMonth, eachWeekendOfMonth, eachWeekendOfYear, previousDay, nextDay, previousSunday, previousMonday, previousTuesday, previousWednesday, previousThursday, previousFriday, previousSaturday, nextSunday, nextMonday, nextTuesday, nextWednesday, nextThursday, nextFriday, nextSaturday } from './iterate.js';
|
|
55
|
-
// International holidays utilities
|
|
56
|
-
export { getUKHolidays, getNetherlandsHolidays, getGermanyHolidays, getCanadaHolidays, getAustraliaHolidays, getItalyHolidays, getSpainHolidays, getChinaHolidays, getIndiaHolidays, getJapanHolidays, getFranceHolidays, getBrazilHolidays, getMexicoHolidays, getSouthKoreaHolidays, getSingaporeHolidays, getPolandHolidays, getSwedenHolidays, getBelgiumHolidays, getSwitzerlandHolidays, getHolidays, isHoliday, getHolidayName, getNextHoliday, getUpcomingHolidays, getSupportedCountries } from './holidays.js';
|
|
57
|
-
// Chain API (fluent interface)
|
|
58
|
-
export { chain, ChainedDate, formatMs } from './chain.js';
|
|
59
|
-
// Plugin system for extending ChainedDate
|
|
60
|
-
export { extend, uninstall, getRegisteredPlugins, getPluginMethods, isPluginRegistered } from './plugins.js';
|
|
61
|
-
// Non-Gregorian calendar utilities
|
|
62
|
-
export { toHebrewDate, toIslamicDate, toBuddhistDate, toJapaneseDate, toPersianDate, toChineseDate, formatInCalendar, getCalendarMonthNames, getJapaneseEra, getJapaneseEras, isHebrewLeapYear, getHebrewMonthName, getIslamicMonthName, getPersianMonthName, isPersianLeapYear, getChineseZodiac, getChineseElement, getChineseZodiacFull, calendarDateToString, compareCalendarDates, today as calendarToday, isSameCalendarDay, getSupportedCalendars } from './calendars.js';
|
|
63
|
-
// Temporal API compatibility layer
|
|
64
|
-
export { toPlainDate, toPlainTime, toPlainDateTime, toZonedDateTime, toInstant, createDuration as createTemporalDuration, parseDuration as parseTemporalDuration, nowInstant, nowPlainDateTime, nowPlainDate, nowPlainTime, nowZonedDateTime, fromTemporal } from './temporal.js';
|
|
65
|
-
// Finance utilities
|
|
66
|
-
export { isMarketOpen, isMarketHoliday, isTradingDay, getMarketHours, getMarketOpen, getMarketClose, getNextMarketOpen, getNextMarketClose, getSettlementDate, getTradeDateFromSettlement, eachTradingDay, countTradingDays, addTradingDays, getOptionsExpiration, MARKET_HOURS, US_MARKET_HOLIDAYS } from './finance.js';
|
|
67
|
-
// Scheduling utilities
|
|
68
|
-
export { generateSlots, generateSlotsForRange, getAvailableSlots, findNextAvailable, isSlotAvailable, findConflicts, hasConflict, addBuffer, removeBuffer, expandRecurringAvailability, mergeBookings, splitSlot, DEFAULT_SCHEDULING_CONFIG } from './scheduling.js';
|
|
69
|
-
// High-precision utilities
|
|
70
|
-
export { createNanosecondTimestamp, fromNanoseconds, dateToNanoseconds, nanosecondsToDate, addNanoseconds, subtractNanoseconds, compareNanoseconds, nowNanoseconds, formatNanoseconds, parseNanoseconds, createHighResDuration, addHighResDuration, subtractHighResDuration, highResDurationToMs, msToHighResDuration, toBigIntMs, fromBigIntMs, toBigIntSeconds, fromBigIntSeconds, addBigIntMs, subtractBigIntMs, diffBigIntMs, isInDSTGap, isInDSTOverlap, getDSTTransitionsInYear, resolveAmbiguousTime, ValidDate, ensureValidDate, parseValidDate, assertValidDate, LEAP_SECONDS, leapSecondsBetween, isNearLeapSecond, taiToUtc, utcToTai } from './precision.js';
|
|
71
|
-
// Healthcare utilities
|
|
72
|
-
export { getMedicationTimes, getNextMedicationTime, parseMedicationFrequency, generateShiftSchedule, getShiftForTime, isOnShift, createOnCallRotation, getOnCallStaff, isWithinComplianceWindow, getComplianceDeadline, timeUntilDeadline, calculateRestBetweenShifts, MEDICATION_FREQUENCIES, SHIFT_DURATIONS, DEFAULT_MEDICATION_CONFIG } from './healthcare.js';
|