shopify/wasm will give unix time of 0 when attempting to get the date
let d = new Date(); // 1970-01-01T00:00:00
So instead, Shopify has a suite of tools to check the date / local time
so, I can check if a time is before, after, or between an expected time … down the the second.
BUT, there is no function to simply pass the full date-time into the function input. the best is:
{shop {localTime {date }}}
Note it is date (not dateTime) From the docs:
Date
Represents an ISO 8601-encoded date string. For example, September 7, 2019 is represented as "2019-07-16".
I can check the day, but not the hour or second. To check with seconds-level granularity, we have to:
- use an external api to check the time?!
- repeatedly check if the time is between some range?!
Solution:
Please add * dateTime * to the graphql schema for the localTime object.