Date not correct time zone despite using moment...
Based on the previous posts in here, created a Calculation field that combines Title and Date, here's the formula:
@Title+ " " + moment(@Date).tz("America/Vancouver").toDate()
Unfortunately the results displayed are 7 hours ahead and also has a weird string "GMT+0000 (UTC)" after the date part:
Title Thu Apr 05 2018 04:38:19 GMT+0000 (UTC)
I don't need the results to be displayed in date format, just as long as it's showing my local time zone. Any ideas how to do this correctly?
By the way, I also can't seem to add the .format string to the end without creating errors. For example:
@Title+ " " + moment(@Date).tz("America/Vancouver").toDate().format("YYYY-MM-DD")
I get:
Preview: Script error: TypeError: undefined is not a function
@Rainer I could use your help if you have a moment, thanks in advance!
-
Hi,
you can't use moment().toDate() in combination with text (or a number). Podio calc field can have 3 formats: text, number, date. If you use moment().toDate() the calculation wants to show it like a date field, if you add text (like you do) you make it a string (= text format). You also can't combine toDate().format() - it must be either or (or you get a script error)
You simply need:
@text + " " + @moment(date).tz("America/Vancouver").format("YYYY-MM-DD")
if you want the result like 2018-04-09.
Hope it helps
Rainer
Please sign in to leave a comment.
Comments
1 comment