javascriptiso8601lokijs

Does LokiJS supports ISO-8601 date format?


When storing a date in ISO-8601 format (a string), will the date operators ($dteq, $dtgte, $dtlte) work out-of-the-box? Or all my children are cursed by javascript date?

Oddhinn Blessadur!


Solution

  • Looking at the source on github (great thing about open source), no. I mean, $dteq works because it just delegates to a general purpose equality test, and the strings match, but $gte/$lte (there's no $dtgte/$dtlte but if I assume you meant those) will try to treat the strings as numbers, which won't work.

    If you stored the dates as numbers (milliseconds-since-The-Epoch), that would work. Or of course, as Date instances.