The now
function from Lodash library can be used to get the current timestamp in milliseconds. Here's an example of how to use now
:
index.tsx175 chars4 lines
Alternatively, you can also use the native JavaScript Date.now()
method to achieve the same result:
index.tsx108 chars3 lines
Both _.now()
and Date.now()
return the number of milliseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
gistlibby LogSnag