Skip to content

hamptonmoore/epoch-rounder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 

Repository files navigation

epoch-rounder

epoch-rounder is a simple utility to round epoch timestands to the closest block of seconds.

Installation

Use the package manager npm to install epoch-rounder.

npm i epoch-rounder --save

Usage

epoch-rounder.floor(EPOCH_TIMESTAMP, CLOSEST_BLOCK_OF_SECONDS);
const epoch-rounder = require("epoch-rounder");

// It supports floor, round, ceil, and trunc
epoch-rounder.floor(1585907250, 300); // returns 1585907100
epoch-rounder.round(1585907250, 300); // returns 1585907400
epoch-rounder.ceil(1585907250, 300); // returns 1585907400
epoch-rounder.trunc(1585907250, 300); // returns 1585907100

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published