Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

mktimestamp

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mktimestamp

generates a timestamp from current or provided date/time, utc or local

latest
npmnpm
Version
1.4.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 25 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts