New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ariesclark/time

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ariesclark/time

Fast, efficient, and easy-to-use time functions for TypeScript.

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source
@ariesclark/time logo

Fast, efficient, and easy-to-use time functions for TypeScript.

Packages

@ariesclark/extensions @ariesclark/array @ariesclark/number @ariesclark/object @ariesclark/string @ariesclark/time @ariesclark/function

Installation

npm install @ariesclark/extensions
# Or directly, if you only need the number extension.
npm install @ariesclark/number

Documentation

MaybeSuffix (type)

Milliseconds (type)

A duration in milliseconds.

DurationLiteral (type)

Duration (type)

A duration value.

Supports the following formats in both short and long form:

  • ms (milliseconds) e.g. 20ms or 20 as a number.
  • s (seconds) e.g. 1s or 1 second.
  • m (minutes) e.g. 2m or 2 minutes.
  • h (hours) e.g. 3h or 3 hours.
  • d (days) e.g. 4d or 4 days.
  • w (weeks) e.g. 5w or 5 weeks.
  • y (years) e.g. 6y or 6 years.

milliseconds (function)

[object Object],[object Object],[object Object]

Parameters:

  • value (Duration)

returns: number

ms('5m'); // 300000, 5 minutes in milliseconds, short form.
ms(300000); // 300000, 5 minutes in milliseconds, pass-through.
ms('2 hours'); // 7200000, 2 hours in milliseconds, long form.

ms (variable)

[object Object],[object Object],[object Object]

now (function)

Current time in milliseconds.

returns: number

Timestamp (type)

[object Object],[object Object],[object Object],[object Object],[object Object]

InvalidTimestampError (variable)

timestamp (function)

[object Object],[object Object],[object Object]

Parameters:

  • timestamp (Timestamp)

returns: number

randomTime (function)

Parameters:

  • offset (Duration)
  • anchor (number)

returns: number

Keywords

FAQs

Package last updated on 21 Apr 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc