ticket.createdAt in ZAFv2

Answered

4 Comments

  • Cheryl Lane
    Comment actions Permalink

    The format should be compatible with JS's Date.parse. This should output a string that is compatible with momentJS.

    var dateObject = Date.parse("Thu Sep 05 2019 15:18:35 GMT+0100 (British Summer Time)");
    var isoString = new Date(dateObject).toISOString();
    1
  • robert matthews
    Comment actions Permalink

    Brilliant, that seems to work perfectly, thanks! 

    0
  • Bryan Flynn
    Comment actions Permalink

    Thanks Cheryl!

    Just a side note, moment.js is also pretty smart around these dates, if you already have it loaded or need it because of some sort of browser incompatibility. This should also work:

    moment("Sat Aug 11 2018 00:59:57 GMT+0100 (Central European Standard Time)").format())

    I like the native way, so this is just another option if it makes sense.

    1
  • robert matthews
    Comment actions Permalink

    Thanks for the alternative suggestion, tried this out and it worked as well :) 

    0

Please sign in to leave a comment.

Powered by Zendesk