Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
campbell-m committed Sep 2, 2023
1 parent 2cf3eb7 commit 7275c1b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions web/js/datepicker.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,10 @@ function getISODate(year, month, day)
// format. (Note that toISOString() returns a date in UTC time).
function getLocalISODateString(date)
{
var month = (date.getMonth() + 1).toString();
var day = date.getDate().toString();
var month = (date.getMonth() + 1).toString().padStart(2, '0');
var day = date.getDate().toString().padStart(2, '0');
var year = date.getFullYear().toString();

if (month.length < 2)
{
month = '0' + month;
}
if (day.length < 2)
{
day = '0' + day;
}

return [year, month, day].join('-');
}

Expand Down

0 comments on commit 7275c1b

Please sign in to comment.