@@ -25,7 +25,7 @@ const MILLIS_IN_DAY = 86400000;
2525export function getDaysArray ( weekday : Intl . DateTimeFormatOptions [ "weekday" ] = "short" ) : string [ ] {
2626 const now = new Date ( ) ;
2727 const { format } = new Intl . DateTimeFormat ( getUserLanguage ( ) , { weekday } ) ;
28- return [ ...Array ( 7 ) . keys ( ) ] . map ( ( day ) => format ( new Date ( ) . getTime ( ) - ( now . getDay ( ) - day ) * MILLIS_IN_DAY ) ) ;
28+ return [ ...Array ( 7 ) . keys ( ) ] . map ( ( day ) => format ( now . getTime ( ) - ( now . getDay ( ) - day ) * MILLIS_IN_DAY ) ) ;
2929}
3030
3131function getMonthsArray ( month : Intl . DateTimeFormatOptions [ "month" ] = "short" ) : string [ ] {
@@ -44,7 +44,7 @@ export function formatDate(date: Date, showTwelveHour = false, locale?: string):
4444 hour : "numeric" ,
4545 minute : "2-digit" ,
4646 hour12 : showTwelveHour ,
47- } ) . format ( new Date ( ) ) ;
47+ } ) . format ( date ) ;
4848 } else if ( now . getFullYear ( ) === date . getFullYear ( ) ) {
4949 return new Intl . DateTimeFormat ( _locale , {
5050 weekday : "short" ,
@@ -53,7 +53,7 @@ export function formatDate(date: Date, showTwelveHour = false, locale?: string):
5353 hour : "numeric" ,
5454 minute : "2-digit" ,
5555 hour12 : showTwelveHour ,
56- } ) . format ( new Date ( ) ) ;
56+ } ) . format ( date ) ;
5757 }
5858 return formatFullDate ( date , showTwelveHour , true , _locale ) ;
5959}
@@ -214,7 +214,7 @@ export function formatFullDateNoDayNoTime(date: Date, locale?: string): string {
214214}
215215
216216export function formatRelativeTime ( date : Date , showTwelveHour = false ) : string {
217- const now = new Date ( Date . now ( ) ) ;
217+ const now = new Date ( ) ;
218218 if ( withinCurrentDay ( date , now ) ) {
219219 return formatTime ( date , showTwelveHour ) ;
220220 } else {
0 commit comments