JSPM

ms-until-hour

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q19703F
  • License MIT

Accepts a date object and returns the number of milliseconds until a given hour

Package Exports

  • ms-until-hour

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ms-until-hour) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Get the number of milliseconds until a given hour

Lightweight helper to get the number of milliseconds from a given date until the hour you specify. Particularly handy for scheduling a setTimeout().

Usage Example

Install npm install ms-until-hour

Return the number of milliseconds between now and 3:00am (03:00):

const msUntilHour = require('ms-until-hour')

msUntilHour(new Date(), 3)

If the current time is 2:20am then this will return 2400000 (40 minutes * 60 seconds * 1000ms).

Return the number of milliseconds between now and 7:00pm (19:00):

const msUntilHour = require('ms-until-hour')

msUntilHour(new Date(), 19)

...you get the idea!

Issues

Please raise a Github issue if you spot any problems.

Contributing

Feel free to submit issues, fixes or new features (ms-until-minute would be nice...):

  • npm run compile - transpile from src to lib
  • npm test - run mocha with code coverage output

Please include tests with any contributions.