File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,6 @@ export class TileList extends BaseTileComponent {
218218 if ( isFirstMillisecondOfUTCYear ( date ) ) {
219219 format = 'year-only' ;
220220 }
221-
222221 return this . metadataTemplate ( formatDate ( date , format ) , msg ( 'Published' ) ) ;
223222 }
224223
Original file line number Diff line number Diff line change @@ -18,12 +18,22 @@ export function formatDate(
1818 // the date is already in UTC timezone so we should not add timeZone here again.
1919 const options : Intl . DateTimeFormatOptions = { } ;
2020
21+ console . log ( 'defined formatDate: ' , date ) ;
2122 switch ( format ) {
2223 case 'year-only' :
2324 // If we're only using the year, ensure we output the correct UTC year and not
2425 // the local year. If the local timezone is used, we can get strange off-by-one
2526 // errors due to quirks of timezone handling for older years.
26- return `${ date . getUTCFullYear ( ) } ` ;
27+ // return `${date.getUTCFullYear()}`;
28+ // Get the UTC year
29+ const utcYear = Date . UTC (
30+ date . getFullYear ( ) ,
31+ date . getMonth ( ) ,
32+ date . getDate ( ) ,
33+ ) ;
34+ console . log ( 'return yearonly: ' , new Date ( utcYear ) ) ;
35+ // Return the UTC year
36+ return `${ new Date ( utcYear ) . getUTCFullYear ( ) } ` ;
2737 case 'short' :
2838 options . month = 'short' ;
2939 options . year = 'numeric' ;
You can’t perform that action at this time.
0 commit comments