Either that or you could keep changing E.setTimeZone depending on how you want the date to appear, which seems to be basically what you're doing?
I'm actually kind of surprised there's nothing standard in the Date class that allows you to change the timezone on a per-date basis, but it seems not!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It's not entirely surprising that the minute parameter doesn't respond well to out of range minutes. I'm extremely surprised it works on desktop!
However I've just tweaked
Date
so new 'cutting edge' - and 2v02+ builds - will have the change in.To do stuff like alter the hour what I'd suggest is to:
var ms = d.getTime();
to get the milliseconds since 1970: http://www.espruino.com/Reference#l_Date_getTimems
however you wantd = new Date(ms)
to rebuild the dateEither that or you could keep changing
E.setTimeZone
depending on how you want the date to appear, which seems to be basically what you're doing?I'm actually kind of surprised there's nothing standard in the
Date
class that allows you to change the timezone on a per-date basis, but it seems not!