Skip to content

Commit

Permalink
addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cellio committed Jun 2, 2021
1 parent 220aac8 commit 6310c60
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions public/assets/community/judaism.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,8 +528,9 @@ $(() => {
* Calendar script, added 2021-04-01 by @luap42
*/

// Use *local* time for ISO string (Date.toISOString() uses UTC).
function toIsoString(date) {
// Use *local* time for ISO string (Date.toISOString() uses UTC).
// We only need the date here, so punting on time.
function toIsoDate(date) {
var tzo = -date.getTimezoneOffset(),

This comment has been minimized.

Copy link
@manassehkatz

manassehkatz Jun 2, 2021

tzo and dif lines should be removed (and pad becomes var pad)

dif = tzo >= 0 ? '+' : '-',
pad = function(num) {
Expand All @@ -539,12 +540,7 @@ $(() => {

return date.getFullYear() +
'-' + pad(date.getMonth() + 1) +
'-' + pad(date.getDate()) +
'T' + pad(date.getHours()) +
':' + pad(date.getMinutes()) +
':' + pad(date.getSeconds()) +
dif + pad(tzo / 60) +
':' + pad(tzo % 60);
'-' + pad(date.getDate());
}


Expand All @@ -559,7 +555,7 @@ window.addEventListener("load", async () => {
let todayDate = new Date();

// Start new day at 8pm local time previous day (if it's 8 or later today is tomorrow).
// Day is zero-indexed, hence > 19 (not > 20).
// Hour is zero-indexed, hence > 19 (not > 20).
if (todayDate.getHours() > 19) {
todayDate.setDate(todayDate.getDate() + 1);
}
Expand All @@ -574,7 +570,7 @@ window.addEventListener("load", async () => {
}, {});

// Do not use Date.toISOString(), which uses UTC not local time.
let now = toIsoString(todayDate).substr(0, 10);
let now = toIsoDate(todayDate);

const fields = parsedData[now];
container.querySelector('._cal_val').innerHTML = "";
Expand Down

0 comments on commit 6310c60

Please sign in to comment.