Using Javascript to change a Date Field for country specific export

Comments

3 comments

  • Rainer Grabowski (FVM)

    Hi Lee,

    it's not a coding issue, it's a logical issue :)

    The date 31.03. in your date field is AFTER DST-change on 29th. The calculation with moment () always takes the current time at the moment you create that field (or the moment one of the values in the formula changes). Change the date in the date field to 28.03. and you'll see that the time in the calculation field will also be 11:00.

    To avoid this DST-issue set the time zone in your calculation:

    moment(@Appointment Date).tz('Europe/London').format("dddd MMM Do YYYY hh.mm a")
    

    Rainer
    rg@delos-consulting.com

    0
    Comment actions Permalink
  • Lee Standell

    You are a good man Rainer, Thank you very much :)

    0
    Comment actions Permalink
  • Patrik Näsfors

    Thanks a lot!

    It solved a problem for me too with all day events, where I am calculating the date to use in the title. When the start date field was set to 14-05-2017 00:00, the date was calculated to 13-05-2017.

    But with the help of the tz time zone function, it solved this problem. So the calculation I'm using now is this:

    moment(@Dato).tz('Europe/Copenhagen').format("DD-MM-YYYY")

    Best regards,

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk