From 2294caa44b8d760912535ee689c503fe34e7bd59 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Tue, 27 Dec 2016 10:57:37 -0800 Subject: [PATCH] add a comment about mis-detecting DateJS dates as locales --- strftime.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/strftime.js b/strftime.js index 8afcd51..e416eea 100644 --- a/strftime.js +++ b/strftime.js @@ -74,6 +74,11 @@ adaptForwards(adaptedStrftime); function adaptedStrftime(fmt, d, locale) { // d and locale are optional, check if this is (format, locale) + // + // `days` is required on all locales, but DateJS modifies `Date` objects and gives them + // a `days` property. We check that the second parameter doesn`t have `getTime`, which + // should never appear in a locale object, before concluding that `d` is in fact a + // locale object and not a date. if (d && d.days && !d.getTime) { locale = d; d = undefined;