@@ -6,10 +6,7 @@ import {
66 formatExpiresInLabel ,
77 formatRelativeTime ,
88 formatRelativeTimeLabel ,
9- formatRelativeTimeUntil ,
10- formatRelativeTimeUntilLabel ,
119 formatShortTimestamp ,
12- formatTimestamp ,
1310 getRelativeTimeState ,
1411 getTimestampFormatOptions ,
1512 resolveTimestampLocale ,
@@ -76,33 +73,6 @@ describe("resolveTimestampLocale", () => {
7673 } ) ;
7774} ) ;
7875
79- describe ( "formatRelativeTimeUntilLabel" , ( ) => {
80- beforeEach ( ( ) => {
81- vi . useFakeTimers ( ) ;
82- vi . setSystemTime ( new Date ( "2026-04-07T12:00:00.000Z" ) ) ;
83- } ) ;
84-
85- afterEach ( ( ) => {
86- vi . useRealTimers ( ) ;
87- } ) ;
88-
89- it ( "returns Expired when the instant is in the past" , ( ) => {
90- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T11:59:00.000Z" ) ) . toBe ( "Expired" ) ;
91- } ) ;
92-
93- it ( "formats seconds remaining" , ( ) => {
94- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T12:00:45.000Z" ) ) . toBe ( "45s left" ) ;
95- } ) ;
96-
97- it ( "formats minutes remaining" , ( ) => {
98- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T12:15:00.000Z" ) ) . toBe ( "15m left" ) ;
99- } ) ;
100-
101- it ( "formats hours remaining" , ( ) => {
102- expect ( formatRelativeTimeUntilLabel ( "2026-04-07T18:00:00.000Z" ) ) . toBe ( "6h left" ) ;
103- } ) ;
104- } ) ;
105-
10676describe ( "formatExpiresInLabel" , ( ) => {
10777 beforeEach ( ( ) => {
10878 vi . useFakeTimers ( ) ;
@@ -196,10 +166,6 @@ describe("formatDayAwareTimestamp", () => {
196166} ) ;
197167
198168describe ( "invalid timestamp inputs" , ( ) => {
199- it ( "returns an empty timestamp instead of throwing" , ( ) => {
200- expect ( formatTimestamp ( "not-a-date" , "12-hour" ) ) . toBe ( "" ) ;
201- } ) ;
202-
203169 it ( "returns an empty short timestamp instead of throwing" , ( ) => {
204170 expect ( formatShortTimestamp ( "not-a-date" , "12-hour" ) ) . toBe ( "" ) ;
205171 } ) ;
@@ -218,11 +184,6 @@ describe("invalid timestamp inputs", () => {
218184 expect ( formatElapsedDurationLabel ( "not-a-date" ) ) . toBe ( "" ) ;
219185 } ) ;
220186
221- it ( "returns an empty relative time until label instead of a NaN label" , ( ) => {
222- expect ( formatRelativeTimeUntil ( "not-a-date" ) ) . toBeNull ( ) ;
223- expect ( formatRelativeTimeUntilLabel ( "not-a-date" ) ) . toBe ( "" ) ;
224- } ) ;
225-
226187 it ( "returns an empty expires-in label instead of a NaN label" , ( ) => {
227188 expect ( formatExpiresInLabel ( "not-a-date" ) ) . toBe ( "" ) ;
228189 } ) ;
0 commit comments