ISODate from object key in shell

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Trivial - P5
    • None
    • Affects Version/s: 3.2.1
    • Component/s: Shell
    • None
    • Fully Compatible
    • ALL
    • Hide

      > var date = ISODate();
      > var o = {};
      > o[date] = true;
      > ISODate(Object.keys(o)[0]); // fails..
      > new Date(Object.keys(o)[0]); // works, and returns an ISODate

      Show
      > var date = ISODate(); > var o = {}; > o [date] = true; > ISODate(Object.keys(o) [0] ); // fails.. > new Date(Object.keys(o) [0] ); // works, and returns an ISODate
    • Platforms 12 (04/01/16)
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      I'm trying to make a unique set of ISODate's, the doc's mention ISODate being a wrapper around `new Date()`. When they're used as object keys they get converted to strings (as expected). If I try to put that string back through the constructor function the iso regex fails.. `throw Error("invalid ISO date");`.

            Assignee:
            Mira Carey
            Reporter:
            Eric Stobbart
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: