@trackunit/date-and-time-utils 1.3.165 → 1.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/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/package.json +2 -2
- package/src/DateAndTimeUtils.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -142,7 +142,7 @@ const formatDateUtil = (date, format, timeZone, locale) => {
|
|
|
142
142
|
* @param {Intl.DateTimeFormatOptions} [format] - Optional formatting options for the date and time.
|
|
143
143
|
* @returns {string} A formatted string representing the date range.
|
|
144
144
|
*/
|
|
145
|
-
const formatRangeUtil = (range, locale, format) => Intl.DateTimeFormat(locale, format).formatRange(range.start, range.end);
|
|
145
|
+
const formatRangeUtil = (range, locale, format) => Intl.DateTimeFormat(locale, format).formatRange(range.start ?? new Date(), range.end ?? new Date());
|
|
146
146
|
/**
|
|
147
147
|
* Subtracts a specified number of minutes from a date.
|
|
148
148
|
*
|
package/index.esm.js
CHANGED
|
@@ -140,7 +140,7 @@ const formatDateUtil = (date, format, timeZone, locale) => {
|
|
|
140
140
|
* @param {Intl.DateTimeFormatOptions} [format] - Optional formatting options for the date and time.
|
|
141
141
|
* @returns {string} A formatted string representing the date range.
|
|
142
142
|
*/
|
|
143
|
-
const formatRangeUtil = (range, locale, format) => Intl.DateTimeFormat(locale, format).formatRange(range.start, range.end);
|
|
143
|
+
const formatRangeUtil = (range, locale, format) => Intl.DateTimeFormat(locale, format).formatRange(range.start ?? new Date(), range.end ?? new Date());
|
|
144
144
|
/**
|
|
145
145
|
* Subtracts a specified number of minutes from a date.
|
|
146
146
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/date-and-time-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@formatjs/intl-enumerator": "^1.8.1",
|
|
11
11
|
"@js-temporal/polyfill": "^0.4.4",
|
|
12
12
|
"@formatjs/intl-durationformat": "^0.6.1",
|
|
13
|
-
"@trackunit/react-test-setup": "1.0
|
|
13
|
+
"@trackunit/react-test-setup": "1.1.0"
|
|
14
14
|
},
|
|
15
15
|
"module": "./index.esm.js",
|
|
16
16
|
"main": "./index.cjs.js",
|
|
@@ -6,8 +6,8 @@ type TemporalTimeTypes = Extract<Intl.RelativeTimeFormatUnit, "days" | "hours" |
|
|
|
6
6
|
type TemporalFormatSelector = "dateOnly" | "timeOnly";
|
|
7
7
|
export type TemporalFormatStyle = Intl.ListFormatStyle;
|
|
8
8
|
export interface DateRange {
|
|
9
|
-
start
|
|
10
|
-
end
|
|
9
|
+
start?: Date;
|
|
10
|
+
end?: Date;
|
|
11
11
|
}
|
|
12
12
|
export interface TemporalFormat {
|
|
13
13
|
selectFormat?: TemporalFormatSelector;
|