From e444e764d6fc988500cf08de5021756d9c0928e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20Bona=C4=87i?= Date: Fri, 26 Jun 2015 13:38:59 +0200 Subject: [PATCH] Fix the bug of comparing dates by reference The way it was, it would have never thrown, not it should if date format is not recognized. --- lib/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parser.js b/lib/parser.js index a5c3fa4..a1c1929 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -53,7 +53,7 @@ function parser(str, offset) { while (this.advance() !== 'eos'); debug('tokens %j', this.tokens) this.nextTime(d); - if (this.date.date == d) throw new Error('Invalid date'); + if (this.date.date - d === 0) throw new Error('Invalid date'); return this.date.date; };