-
• #2
Hi,
Yes, that's intentional. Normal Javascript has a date class that we implement, and it works just like that.
It's strange I know - but it would be worse if we behaved totally different to normal javascript.
-
• #3
Is this module available for Puck.js ? I tried this code and it says module "clock" not found.
-
• #4
Did you upload using the right-hand side of the IDE? The
clock
module needs to be loaded off the net, so it has to be uploaded first via the right-hand side so the IDE can detect its use and upload it.However, you may find that the
Date
class does everything that you need all by itself? http://www.espruino.com/Reference#DateYou can turn on
Set Current Time
in the Web IDE so that it will automatically set the correct time whenever you upload code.
From above ...
var clk=new Clock(2014,4,15,23,45,0,0); // Initialise with specific date
print(d1.toString()); // prints "Thu May 15 2014 23:45:05"
It does what it says BUT the number "4" for the month is April and 5 should be for May.
Looks like someone started to use, for the months, 0-11 and not the normal 1-12?
Are you going to keep the months index this way?
Windows 8.1 64 Bit
Chrome 35.0.1916.153 m (no beta)
Espruino 1v69
Web-IDE v 45
Board: Espruino v 1.3