jstimestamp
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

License NPM version Downloads
Build Status Coverage

npm install jstimestamp@latest

Summary

This is an abstraction of the JavaScript timestamp with some validation created to share the standard Date object between browser and server without large libraries. It's basically Date.now() with a custom type and validation
If you're looking for an advanced Date library please checkout: Luxon or momentjs. This library does not contain any timezone manipulation.

Usage

The library exposes a type which is basically an alias for a string, this is just for clarity while developing.
Also there are tree methods included:

  • isJsTimestamp: Validates values to be a valid JsTimestamp
  • toJsTimestamp: Converts Date objects to a JsTimeStamp
  • stamp: Date.now but casted to a JsTimestamp
  • toDate: Convert a JsTimestamp to a Date

Contributing

See the Contribution guide for help about contributing to this project.

Changelog

See the Changelog to see the change history.

Dependencies (1)

Dev Dependencies (7)

Package Sidebar

Install

npm i jstimestamp

Weekly Downloads

1

Version

1.0.0

License

Apache-2.0

Unpacked Size

41.5 kB

Total Files

39

Last publish

Collaborators

  • marvin-brouwer