File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export default function ListensTable({
2121 hideArtists,
2222 onDelete,
2323} : ListensTableProps ) {
24- const { user } = useAppContext ( ) ;
24+ const { user, dateFormat } = useAppContext ( ) ;
2525 const imgColSizeClasses = "py-3 min-w-8 sm:min-w-11" ;
2626 const imgSize = 32 ;
2727 const timeColClasses = "text-(--color-fg-tertiary) pr-2 sm:pr-4 sm:text-sm" ;
@@ -99,7 +99,7 @@ export default function ListensTable({
9999 className = { `text-end whitespace-nowrap ${ timeColClasses } ` }
100100 title = { new Date ( item . time ) . toString ( ) }
101101 >
102- { timeSince ( new Date ( item . time ) ) }
102+ { timeSince ( new Date ( item . time ) , dateFormat ) }
103103 </ td >
104104 < td className = "hidden sm:table" >
105105 < button
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const getRewindParams = (): { month: number; year: number } => {
2828 }
2929} ;
3030
31- function timeSince ( date : Date ) {
31+ function timeSince ( date : Date , format : string = "" ) {
3232 const now = new Date ( ) ;
3333 const seconds = Math . floor ( ( now . getTime ( ) - date . getTime ( ) ) / 1000 ) ;
3434
@@ -44,12 +44,7 @@ function timeSince(date: Date) {
4444
4545 // 1 day
4646 if ( seconds > 86400 ) {
47- const dateString = date . toLocaleDateString ( [ ] , {
48- month : "numeric" ,
49- year : "2-digit" ,
50- day : "numeric" ,
51- } ) ;
52-
47+ const dateString = formatDate ( date , format ) ;
5348 const timeString = date . toLocaleTimeString ( [ ] , {
5449 timeStyle : "short" ,
5550 } ) ;
You can’t perform that action at this time.
0 commit comments