@trackunit/react-date-and-time-hooks 1.14.11 → 1.14.12
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 +3 -4
- package/index.esm.js +1 -2
- package/package.json +9 -10
package/index.cjs.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var polyfill = require('@js-temporal/polyfill');
|
|
4
3
|
var dateAndTimeUtils = require('@trackunit/date-and-time-utils');
|
|
5
4
|
var sharedUtils = require('@trackunit/shared-utils');
|
|
6
5
|
var react = require('react');
|
|
@@ -132,7 +131,7 @@ const useTimezone = ({ assetId } = {}) => {
|
|
|
132
131
|
return dateAndTimeUtils.getTimeZone(timezone);
|
|
133
132
|
}, [timeZoneData?.asset?.locations?.latest?.properties?.timeZone]);
|
|
134
133
|
const current = react.useMemo(() => {
|
|
135
|
-
const id =
|
|
134
|
+
const id = dateAndTimeUtils.Temporal.Now.timeZoneId();
|
|
136
135
|
if (timeZonePreference === irisAppRuntimeCoreApi.TimeZonePreference.CustomTimeZone && customTimezone) {
|
|
137
136
|
return dateAndTimeUtils.getTimeZone(customTimezone);
|
|
138
137
|
}
|
|
@@ -160,7 +159,7 @@ const useDateAndTime = () => {
|
|
|
160
159
|
const currentLocale = useLocale();
|
|
161
160
|
const { current, assetTimeZone, preferred } = useTimezone();
|
|
162
161
|
const currentTimeZone = react.useMemo(() => current.id || preferred.id || assetTimeZone?.id, [current, assetTimeZone, preferred]);
|
|
163
|
-
const currentDate = react.useMemo(() => dateAndTimeUtils.toZonedDateTimeUtil(
|
|
162
|
+
const currentDate = react.useMemo(() => dateAndTimeUtils.toZonedDateTimeUtil(dateAndTimeUtils.Temporal.Now.instant(), currentTimeZone), [currentTimeZone]);
|
|
164
163
|
/**
|
|
165
164
|
* Returns the current date and time.
|
|
166
165
|
*
|
|
@@ -436,7 +435,7 @@ const useDateAndTime = () => {
|
|
|
436
435
|
const duration = react.useCallback((from, type, format, roundAt) => {
|
|
437
436
|
const durationValue = typeof from === "number"
|
|
438
437
|
? dateAndTimeUtils.toDuration(from, type, roundAt)
|
|
439
|
-
:
|
|
438
|
+
: dateAndTimeUtils.Temporal.Duration.from(from).round({ smallestUnit: roundAt ?? "minute" });
|
|
440
439
|
return dateAndTimeUtils.getDurationFormat(durationValue, currentLocale, format);
|
|
441
440
|
}, [currentLocale]);
|
|
442
441
|
/**
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Temporal } from '@
|
|
2
|
-
import { getTimeZone, toZonedDateTimeUtil, toDateUtil, 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';
|
|
1
|
+
import { getTimeZone, Temporal, toZonedDateTimeUtil, toDateUtil, 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';
|
|
3
2
|
import { exhaustiveCheck } from '@trackunit/shared-utils';
|
|
4
3
|
import { useMemo, useCallback } from 'react';
|
|
5
4
|
import { TimeZonePreference } from '@trackunit/iris-app-runtime-core-api';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-date-and-time-hooks",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.12",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -13,15 +13,14 @@
|
|
|
13
13
|
"@apollo/client": "3.13.8",
|
|
14
14
|
"react": "19.0.0",
|
|
15
15
|
"zod": "^3.23.8",
|
|
16
|
-
"@trackunit/iris-app-api": "1.14.
|
|
17
|
-
"@trackunit/react-core-contexts-test": "1.12.
|
|
18
|
-
"@trackunit/date-and-time-utils": "1.11.
|
|
19
|
-
"@trackunit/shared-utils": "1.13.
|
|
20
|
-
"@trackunit/react-core-hooks": "1.12.
|
|
21
|
-
"@
|
|
22
|
-
"@trackunit/react-
|
|
23
|
-
"@trackunit/
|
|
24
|
-
"@trackunit/iris-app-runtime-core-api": "1.12.49"
|
|
16
|
+
"@trackunit/iris-app-api": "1.14.70",
|
|
17
|
+
"@trackunit/react-core-contexts-test": "1.12.53",
|
|
18
|
+
"@trackunit/date-and-time-utils": "1.11.68",
|
|
19
|
+
"@trackunit/shared-utils": "1.13.67",
|
|
20
|
+
"@trackunit/react-core-hooks": "1.12.55",
|
|
21
|
+
"@trackunit/react-components": "1.18.7",
|
|
22
|
+
"@trackunit/react-graphql-hooks": "1.15.12",
|
|
23
|
+
"@trackunit/iris-app-runtime-core-api": "1.12.50"
|
|
25
24
|
},
|
|
26
25
|
"module": "./index.esm.js",
|
|
27
26
|
"main": "./index.cjs.js",
|