Update Date to UTC and Time to include days

This commit is contained in:
Matthew Olker 2024-06-14 13:40:14 -04:00
parent f8062d95bb
commit c02bb9132f
2 changed files with 6 additions and 5 deletions

View File

@ -17,8 +17,8 @@ const timedEvents: TimedEvent[] = [
name: "Pride Update", name: "Pride Update",
eventType: EventType.SHINY, eventType: EventType.SHINY,
shinyMultiplier: 2, shinyMultiplier: 2,
startDate: new Date(2024, 5, 14), startDate: new Date(Date.UTC(2024, 5, 14, 0)),
endDate: new Date(2024, 5, 21), endDate: new Date(Date.UTC(2024, 5, 21, 0)),
bannerFilename: "pride-update" bannerFilename: "pride-update"
}, },
]; ];

View File

@ -55,7 +55,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
bannerShadow.setOrigin(0,0); bannerShadow.setOrigin(0,0);
this.eventTimerText = addTextObject( this.eventTimerText = addTextObject(
this.scene, this.scene,
banner.x + 22, banner.x + 8,
banner.y + 100, banner.y + 100,
this.timeToGo(event.endDate), this.timeToGo(event.endDate),
TextStyle.WINDOW TextStyle.WINDOW
@ -102,12 +102,13 @@ export default class TitleUiHandler extends OptionSelectUiHandler {
diff = Math.abs(diff); diff = Math.abs(diff);
// Get time components // Get time components
const hours = diff/3.6e6 | 0; const days = diff/8.64e7 | 0;
const hours = diff%8.64e7 / 3.6e6 | 0;
const mins = diff%3.6e6 / 6e4 | 0; const mins = diff%3.6e6 / 6e4 | 0;
const secs = Math.round(diff%6e4 / 1e3); const secs = Math.round(diff%6e4 / 1e3);
// Return formatted string // Return formatted string
return "Event Ends in : " + z(hours) + ":" + z(mins) + ":" + z(secs); return "Event Ends in : " + z(days) + "d " + z(hours) + "h " + z(mins) + "m " + z(secs)+ "s";
} }
updateCountdown() { updateCountdown() {