amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

is it a way in AMP to get current date and its timezone ? example (GMT+0800)

Open leonahliang90 opened this issue 8 years ago • 2 comments

in javascript, we can write something likenew Date().toTimeString(); and it will display "17:08:21 GMT+0800 (CST)"

is there any component/ way that we can use to get similar result related to above ?

leonahliang90 avatar Mar 05 '18 09:03 leonahliang90

@leonalicious Do you need the data for display on the client-side or to send to the server?

If client-side, amp-bind currently does not support date. Please subscribe to the FR https://github.com/ampproject/amphtml/issues/11901.

If need this data to send to server, you can get TIMEZONE and TIMESTAMP via variable substitution ( https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#device-and-browser ).

Hope this helps.

aghassemi avatar Mar 05 '18 17:03 aghassemi

Closing the issue since dup of #11901 and server-side workaround documented above.

aghassemi avatar Mar 05 '18 17:03 aghassemi