I’m asking in the beginners’ section in case this is quite obvious to most of you. When I invoke (js/Date.) in the REPL (I am using shadow-cljs) I get today’s date according to Universal Control Time, and when I do so in my app I get today’s date according to my local timezone.
Anyone care to offer an explanation as to why this is so?
There is no such thing as “shadow’s time zone”. When printing a javascript Date the default implementation prints the output in UTC format. It is done this way to be more portable between CLJ and CLJS and because it “makes sense”.
When looking at it on the browser console or just calling .toString you get the default representation the browser choses which is in your local timezone.
There is no such thing as REPL-time or Browser-time. They are the exact same times just printed differently. You cannot modify the REPL representation but if it bothers you can use (.toLocaleString the-date) or (.toString the-date) instead.