@trackunit/react-date-and-time-hooks 1.22.3 → 1.22.5
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/index.cjs.js +0 -14
- package/index.esm.js +1 -15
- package/package.json +9 -9
- package/src/useDateAndTime.d.ts +0 -26
package/index.cjs.js
CHANGED
|
@@ -507,14 +507,6 @@ const useDateAndTime = () => {
|
|
|
507
507
|
const getUTCFromTimeZonedDate = react.useCallback((from, timeZoneId) => {
|
|
508
508
|
return dateAndTimeUtils.getUTCFromTimeZonedUtil(from, timeZoneId);
|
|
509
509
|
}, []);
|
|
510
|
-
/**
|
|
511
|
-
* Formats a {@link Date} as a short locale-aware calendar day using the hook's current locale.
|
|
512
|
-
*
|
|
513
|
-
* @param {Date | undefined} date - The date to format.
|
|
514
|
-
* @returns {string} Short date such as `"Mar 7, 2025"` (English), or `""` when the input is
|
|
515
|
-
* `undefined` or an invalid Date.
|
|
516
|
-
*/
|
|
517
|
-
const formatShortDate = react.useCallback((date) => dateAndTimeUtils.formatShortDateUtil(date, currentLocale), [currentLocale]);
|
|
518
510
|
return react.useMemo(() => ({
|
|
519
511
|
getNowDate,
|
|
520
512
|
nowDate,
|
|
@@ -537,11 +529,6 @@ const useDateAndTime = () => {
|
|
|
537
529
|
dayName,
|
|
538
530
|
days,
|
|
539
531
|
getUTCFromTimeZonedDate,
|
|
540
|
-
parseYYYYMMDD: dateAndTimeUtils.parseYYYYMMDDUtil,
|
|
541
|
-
dateToYYYYMMDD: dateAndTimeUtils.dateToYYYYMMDDUtil,
|
|
542
|
-
YYYYMMDDToUTCMidnightISO: dateAndTimeUtils.YYYYMMDDToUTCMidnightISOUtil,
|
|
543
|
-
dateToUTCMidnightISO: dateAndTimeUtils.dateToUTCMidnightISOUtil,
|
|
544
|
-
formatShortDate,
|
|
545
532
|
}), [
|
|
546
533
|
add,
|
|
547
534
|
convert,
|
|
@@ -554,7 +541,6 @@ const useDateAndTime = () => {
|
|
|
554
541
|
formatDate,
|
|
555
542
|
formatDateWithTimezone,
|
|
556
543
|
formatRange,
|
|
557
|
-
formatShortDate,
|
|
558
544
|
getNowDate,
|
|
559
545
|
getUTCFromTimeZonedDate,
|
|
560
546
|
monthName,
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getTimeZone, Temporal, toDateUtil, toZonedDateTimeUtil, formatDateUtil, formatRangeUtil, subtractYearsUtil, subtractMonthsUtil, subtractWeeksUtil, subtractDaysUtil, subtractHoursUtil, subtractMinutesUtil, addYearsUtil, addMonthsUtil, addWeeksUtil, addDaysUtil, addHoursUtil, addMinutesUtil, startOfMonthUtil, startOfWeekUtil, startOfDayUtil, startOfHourUtil, startOfMinuteUtil, endOfMonthUtil, endOfWeekUtil, endOfDayUtil, endOfHourUtil, endOfMinuteUtil, differenceInYearsUtil, differenceInMonthsUtil, differenceInWeeksUtil, differenceInDaysUtil, differenceInHoursUtil, differenceInMinutesUtil, differenceInSecondsUtil, isBetweenUtil, isTodayUtil, isFutureUtil, isPastUtil, isSameYearUtil, isSameMonthUtil, isSameWeekUtil, isSameDayUtil, timeSinceInYears, timeSinceInMonths, timeSinceInDays, timeSinceInHours, timeSinceInMinutes, timeSinceInSeconds, timeSinceAuto, toDuration, getDurationFormat, convertMillisecondsUtil, convertSecondsUtil, convertMinutesUtil, convertHoursUtil, dayNameUtil, daysUtil, monthNameUtil, monthsUtil, getUTCFromTimeZonedUtil,
|
|
1
|
+
import { getTimeZone, Temporal, toDateUtil, toZonedDateTimeUtil, formatDateUtil, formatRangeUtil, subtractYearsUtil, subtractMonthsUtil, subtractWeeksUtil, subtractDaysUtil, subtractHoursUtil, subtractMinutesUtil, addYearsUtil, addMonthsUtil, addWeeksUtil, addDaysUtil, addHoursUtil, addMinutesUtil, startOfMonthUtil, startOfWeekUtil, startOfDayUtil, startOfHourUtil, startOfMinuteUtil, endOfMonthUtil, endOfWeekUtil, endOfDayUtil, endOfHourUtil, endOfMinuteUtil, differenceInYearsUtil, differenceInMonthsUtil, differenceInWeeksUtil, differenceInDaysUtil, differenceInHoursUtil, differenceInMinutesUtil, differenceInSecondsUtil, isBetweenUtil, isTodayUtil, isFutureUtil, isPastUtil, isSameYearUtil, isSameMonthUtil, isSameWeekUtil, isSameDayUtil, timeSinceInYears, timeSinceInMonths, timeSinceInDays, timeSinceInHours, timeSinceInMinutes, timeSinceInSeconds, timeSinceAuto, toDuration, getDurationFormat, convertMillisecondsUtil, convertSecondsUtil, convertMinutesUtil, convertHoursUtil, dayNameUtil, daysUtil, monthNameUtil, monthsUtil, getUTCFromTimeZonedUtil, isEqualUtil } from '@trackunit/date-and-time-utils';
|
|
2
2
|
import { exhaustiveCheck } from '@trackunit/shared-utils';
|
|
3
3
|
import { useMemo, useCallback } from 'react';
|
|
4
4
|
import { TimeZonePreference } from '@trackunit/iris-app-runtime-core-api';
|
|
@@ -505,14 +505,6 @@ const useDateAndTime = () => {
|
|
|
505
505
|
const getUTCFromTimeZonedDate = useCallback((from, timeZoneId) => {
|
|
506
506
|
return getUTCFromTimeZonedUtil(from, timeZoneId);
|
|
507
507
|
}, []);
|
|
508
|
-
/**
|
|
509
|
-
* Formats a {@link Date} as a short locale-aware calendar day using the hook's current locale.
|
|
510
|
-
*
|
|
511
|
-
* @param {Date | undefined} date - The date to format.
|
|
512
|
-
* @returns {string} Short date such as `"Mar 7, 2025"` (English), or `""` when the input is
|
|
513
|
-
* `undefined` or an invalid Date.
|
|
514
|
-
*/
|
|
515
|
-
const formatShortDate = useCallback((date) => formatShortDateUtil(date, currentLocale), [currentLocale]);
|
|
516
508
|
return useMemo(() => ({
|
|
517
509
|
getNowDate,
|
|
518
510
|
nowDate,
|
|
@@ -535,11 +527,6 @@ const useDateAndTime = () => {
|
|
|
535
527
|
dayName,
|
|
536
528
|
days,
|
|
537
529
|
getUTCFromTimeZonedDate,
|
|
538
|
-
parseYYYYMMDD: parseYYYYMMDDUtil,
|
|
539
|
-
dateToYYYYMMDD: dateToYYYYMMDDUtil,
|
|
540
|
-
YYYYMMDDToUTCMidnightISO: YYYYMMDDToUTCMidnightISOUtil,
|
|
541
|
-
dateToUTCMidnightISO: dateToUTCMidnightISOUtil,
|
|
542
|
-
formatShortDate,
|
|
543
530
|
}), [
|
|
544
531
|
add,
|
|
545
532
|
convert,
|
|
@@ -552,7 +539,6 @@ const useDateAndTime = () => {
|
|
|
552
539
|
formatDate,
|
|
553
540
|
formatDateWithTimezone,
|
|
554
541
|
formatRange,
|
|
555
|
-
formatShortDate,
|
|
556
542
|
getNowDate,
|
|
557
543
|
getUTCFromTimeZonedDate,
|
|
558
544
|
monthName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-date-and-time-hooks",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.5",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"@graphql-codegen/cli": "^5.0.3",
|
|
11
11
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
12
12
|
"zod": "^3.25.76",
|
|
13
|
-
"@trackunit/iris-app-api": "1.18.
|
|
14
|
-
"@trackunit/react-core-contexts-test": "1.15.
|
|
15
|
-
"@trackunit/date-and-time-utils": "1.11.
|
|
16
|
-
"@trackunit/shared-utils": "1.13.
|
|
17
|
-
"@trackunit/react-core-hooks": "1.15.
|
|
18
|
-
"@trackunit/react-components": "1.22.
|
|
19
|
-
"@trackunit/react-graphql-hooks": "1.23.
|
|
20
|
-
"@trackunit/iris-app-runtime-core-api": "1.14.
|
|
13
|
+
"@trackunit/iris-app-api": "1.18.3",
|
|
14
|
+
"@trackunit/react-core-contexts-test": "1.15.35",
|
|
15
|
+
"@trackunit/date-and-time-utils": "1.11.121",
|
|
16
|
+
"@trackunit/shared-utils": "1.13.118",
|
|
17
|
+
"@trackunit/react-core-hooks": "1.15.36",
|
|
18
|
+
"@trackunit/react-components": "1.22.27",
|
|
19
|
+
"@trackunit/react-graphql-hooks": "1.23.4",
|
|
20
|
+
"@trackunit/iris-app-runtime-core-api": "1.14.34"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@apollo/client": "^3.13.8",
|
package/src/useDateAndTime.d.ts
CHANGED
|
@@ -34,32 +34,6 @@ interface UseDateAndTimeReturn {
|
|
|
34
34
|
months: (format?: TemporalFormatStyle) => Array<string>;
|
|
35
35
|
getUTCFromTimeZonedDate: (from: Date, timeZoneId: string) => Date;
|
|
36
36
|
isEqual: (date1: TemporalDate, date2: TemporalDate) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Parses a strict `YYYY-MM-DD` string into a local-midnight {@link Date}. Returns `null` for
|
|
39
|
-
* any other format or for an invalid calendar day.
|
|
40
|
-
*/
|
|
41
|
-
parseYYYYMMDD: (value: string) => Date | null;
|
|
42
|
-
/**
|
|
43
|
-
* Converts a {@link Date} to the canonical `YYYY-MM-DD` string for its local calendar day.
|
|
44
|
-
* Time-zone safe replacement for `date.toISOString().split("T")[0]`. `undefined` and invalid
|
|
45
|
-
* Dates yield `""`.
|
|
46
|
-
*/
|
|
47
|
-
dateToYYYYMMDD: (date: Date | undefined) => string;
|
|
48
|
-
/**
|
|
49
|
-
* Converts a strict `YYYY-MM-DD` string to the ISO timestamp at UTC midnight for that day.
|
|
50
|
-
* Returns `null` for invalid input.
|
|
51
|
-
*/
|
|
52
|
-
YYYYMMDDToUTCMidnightISO: (value: string) => string | null;
|
|
53
|
-
/**
|
|
54
|
-
* Converts a {@link Date} to the ISO timestamp at UTC midnight for its local calendar day.
|
|
55
|
-
* Invalid Dates yield `""`.
|
|
56
|
-
*/
|
|
57
|
-
dateToUTCMidnightISO: (date: Date) => string;
|
|
58
|
-
/**
|
|
59
|
-
* Formats a {@link Date} as a short locale-aware calendar day using the hook's current locale
|
|
60
|
-
* (e.g. `"Mar 7, 2025"` in English). `undefined` and invalid Dates yield `""`.
|
|
61
|
-
*/
|
|
62
|
-
formatShortDate: (date: Date | undefined) => string;
|
|
63
37
|
}
|
|
64
38
|
/**
|
|
65
39
|
* Hook for locale- and timezone-aware date/time operations including formatting,
|