Hiya,
I need to do some date comparisons within my Checkout Extension, which of course requires getting the current DateTime..
Currently I’m simply doing:
const todaysDate = new Date();
However..
- It won’t be in the Stores Datetime
- I’ve read multiple sources saying that creating dates this way can have undesirable results
Are there any best practices or alternatives to getting the stores current date? I can’t see anything within the API options, the only other idea I have is to use a Shop Metafield and Flow to keep it up to date each day ![]()
As for the reason as to why I require the current DateTime, I’m using the DatePicker component but need to be able to block off dates based on a relative factor, i.e. lead days. The relative factor should be against the store, and not the users timezone.
Thanks in advance.