1
- import { DurationFormat } from "@formatjs/intl-durationformat" ;
2
1
import type { DurationInput } from "@formatjs/intl-durationformat/src/types" ;
3
2
import memoizeOne from "memoize-one" ;
4
3
import type { HaDurationData } from "../../components/ha-duration-input" ;
@@ -49,7 +48,7 @@ export const formatNumericDuration = (
49
48
50
49
const formatDurationLongMem = memoizeOne (
51
50
( locale : FrontendLocaleData ) =>
52
- new DurationFormat ( locale . language , {
51
+ new Intl . DurationFormat ( locale . language , {
53
52
style : "long" ,
54
53
} )
55
54
) ;
@@ -61,7 +60,7 @@ export const formatDurationLong = (
61
60
62
61
const formatDigitalDurationMem = memoizeOne (
63
62
( locale : FrontendLocaleData ) =>
64
- new DurationFormat ( locale . language , {
63
+ new Intl . DurationFormat ( locale . language , {
65
64
style : "digital" ,
66
65
hoursDisplay : "auto" ,
67
66
} )
@@ -78,39 +77,39 @@ type DurationUnit = (typeof DURATION_UNITS)[number];
78
77
79
78
const formatDurationDayMem = memoizeOne (
80
79
( locale : FrontendLocaleData ) =>
81
- new DurationFormat ( locale . language , {
80
+ new Intl . DurationFormat ( locale . language , {
82
81
style : "narrow" ,
83
82
daysDisplay : "always" ,
84
83
} )
85
84
) ;
86
85
87
86
const formatDurationHourMem = memoizeOne (
88
87
( locale : FrontendLocaleData ) =>
89
- new DurationFormat ( locale . language , {
88
+ new Intl . DurationFormat ( locale . language , {
90
89
style : "narrow" ,
91
90
hoursDisplay : "always" ,
92
91
} )
93
92
) ;
94
93
95
94
const formatDurationMinuteMem = memoizeOne (
96
95
( locale : FrontendLocaleData ) =>
97
- new DurationFormat ( locale . language , {
96
+ new Intl . DurationFormat ( locale . language , {
98
97
style : "narrow" ,
99
98
minutesDisplay : "always" ,
100
99
} )
101
100
) ;
102
101
103
102
const formatDurationSecondMem = memoizeOne (
104
103
( locale : FrontendLocaleData ) =>
105
- new DurationFormat ( locale . language , {
104
+ new Intl . DurationFormat ( locale . language , {
106
105
style : "narrow" ,
107
106
secondsDisplay : "always" ,
108
107
} )
109
108
) ;
110
109
111
110
const formatDurationMillisecondMem = memoizeOne (
112
111
( locale : FrontendLocaleData ) =>
113
- new DurationFormat ( locale . language , {
112
+ new Intl . DurationFormat ( locale . language , {
114
113
style : "narrow" ,
115
114
millisecondsDisplay : "always" ,
116
115
} )
0 commit comments