File tree 2 files changed +11
-2
lines changed
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 {
218
218
if ( isFirstMillisecondOfUTCYear ( date ) ) {
219
219
format = 'year-only' ;
220
220
}
221
-
222
221
return this . metadataTemplate ( formatDate ( date , format ) , msg ( 'Published' ) ) ;
223
222
}
224
223
Original file line number Diff line number Diff line change @@ -18,12 +18,22 @@ export function formatDate(
18
18
// the date is already in UTC timezone so we should not add timeZone here again.
19
19
const options : Intl . DateTimeFormatOptions = { } ;
20
20
21
+ console . log ( 'defined formatDate: ' , date ) ;
21
22
switch ( format ) {
22
23
case 'year-only' :
23
24
// If we're only using the year, ensure we output the correct UTC year and not
24
25
// the local year. If the local timezone is used, we can get strange off-by-one
25
26
// 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 ( ) } ` ;
27
37
case 'short' :
28
38
options . month = 'short' ;
29
39
options . year = 'numeric' ;
You can’t perform that action at this time.
0 commit comments