Use this package to easily convert various time formats to milliseconds. Works both in Node.js and in the browser. If a number is supplied to ms, a string with a unit is returned. If a string that contains the number is supplied, it returns it as a number (e.g.: it returns 100 for '100'). If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned. For added safety, we're using Template Literal Types (added in TypeScript 4.1). This ensures that you don't accidentally pass ms values that it can't process. This won't require you to do anything special in most situations, but you can also import the StringValue type from ms if you need to use it.

Features

  • Convert various time formats to milliseconds
  • Convert from Milliseconds
  • Time Format configuration
  • As of v3.0, this package includes TypeScript definitions
  • You may also create a custom Template Literal Type
  • Run ms as a macro at build-time

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow ms

ms Web Site

Other Useful Business Software
Peer to Peer Recognition Brings Teams Together Icon
Peer to Peer Recognition Brings Teams Together

The modern employee engagement platform for the modern workforce

Create a positive and energetic workplace environment with Motivosity, an innovative employee recognition and engagement platform. With Motivosity, employees can give each other small monetary bonuses for doing great things, promoting trust, collaboration, and appreciation in the workplace. The software solution comes with features such as an open-currency open-reward system, insights and analytics, dynamic organization chart, award programs, milestones, and more.
Learn More
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of ms!

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Scientific Engineering

Registered

2022-02-15