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.