mirror of
https://github.com/samsonjs/strftime.git
synced 2026-03-25 09:05:48 +00:00
add a comment about mis-detecting DateJS dates as locales
This commit is contained in:
parent
65aa4d5ea9
commit
2294caa44b
1 changed files with 5 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue