Skip to content

Commit

Permalink
Merge pull request #76 from WMEValidator/a-fix-past2
Browse files Browse the repository at this point in the history
Fix $isInThePast time (again)
  • Loading branch information
davidakachaos authored Oct 16, 2018
2 parents bc3b6ed + 8820a6a commit deceef3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,16 @@ function F_VALIDATE(disabledHL) {
this.$toDate = (timeFrame.getEndDate() || "");
/** @type {string} */
this.$toTime = (timeFrame.getToTime() || "");

/*
* To avoid any issues with time zones, report expired
* restrictions 1-2 days after.
*/
var past = new Date();
past.setDate(past.getDate() - 2); /* 2..days().ago() */
/** @type {boolean} */
this.$isInThePast = new Date(this.$toDate +
" " + this.$toTime) < new Date();
this.$isInThePast = new Date(this.$toDate + " " +
this.$toTime) < past;

Object.defineProperties(this, {
_to: { enumerable: false },
Expand Down

0 comments on commit deceef3

Please sign in to comment.