mktimestamp
v1.4.0
Published
generates a timestamp from current or provided date/time, utc or local
Downloads
27
Readme
mktimestamp
generates a timestamp from current or provided date/time, utc or local
Why?
Mostly because I need a UTC timestamp, but this package allows conversion
of arbitrary timestamps to UTC or, in the simplest case, acts as a configurable
proxy to Date.now()
Usage
import { mktimestamp, utcnow, now } from "mktimestamp";
const rightNow = mktimestamp();
const utcNow = mktimestamp({ utc: true });
const utcSomeOtherTime = mktimestamp({ utc: true, timestamp: 1596020185055 });
// alternative invocations
const rightNow2 = mktimestamp("local");
const utcNow2 = mktimestamp("utc");
// convenience functions
const utcNow3 = utcnow();
const rightNow3 = now();
Credits
This project is made easier by:
- newts
- Free licensing of WebStorm due to the JetBrains Open Source License program