From c347ff559b6286f29f15346f4c4816a307050950 Mon Sep 17 00:00:00 2001 From: Elango Cheran Date: Tue, 13 Aug 2024 14:29:45 -0700 Subject: [PATCH] Set program initial day based on local TZ, not UTC --- _includes/js/program.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/_includes/js/program.js b/_includes/js/program.js index ea4f5904..519d61b4 100644 --- a/_includes/js/program.js +++ b/_includes/js/program.js @@ -16,13 +16,21 @@ window.conference.program = (() => { // Switch to day if today else { let today = new Date(); - today.setHours(0,0,0,0); + let localDateString = today.getFullYear() + "-"; + let month = today.getMonth(); + month = month + 1; + if (month < 10) { + localDateString = localDateString + '0'; + } + localDateString = localDateString + month + "-"; + let dayOfMonth = today.getDate(); + if (dayOfMonth < 10) { + localDateString = localDateString + "0"; + } + localDateString = localDateString + dayOfMonth; $('a[data-toggle="tab"]').each(function () { - let d = new Date($(this).data('date')); - d.setHours(0,0,0,0); - - if (today.getTime() === d.getTime()) { + if ($(this).data('date') === localDateString) { $(this).tab('show'); updateHash(this.hash); }