How to new Date()?



How do I do the equivalent of new Date()?
I’ve tried let now = new Js.Date();, but I get this error:

>>>> Start compiling
[1/2] Building src/Component1.mlast
File "/home/kabo/Documents/lmt/src/", line 15, characters 22-23:
Error: 73: <syntax error>
File "/home/kabo/Documents/lmt/src/", line 1, characters 0-0:
Error: Error while running external preprocessor
Command line: /home/kabo/Documents/lmt/node_modules/bs-platform/lib/refmt.exe --print binary '/home/kabo/Documents/lmt/src/' > /tmp/ocamlppd16d79

ninja: error: rebuilding '': subcommand failed
>>>> Finish compiling(exit: 1)

There doesn’t seem to be much info on new or Date in the docs…


You don’t need the new keyword here.

let now  = Js.Date.make();


The api of Js.Date can be found here:


That’s exactly what I was looking for, thanks.

Another gotcha for the next guy reading this:
This doesn’t work:

let now = Js.Date.make();

Here’s how to do it:

let now = Js.Date.make();