time-aritimetic
v1.0.12
Published
finally, a good dates library
Downloads
2
Readme
Time Aritimetic
finally, a good dates library
dates as numbers, do additions, substractions, and comparisons.
const ta = require("time-aritimatic")
ta.now() - ta.days(1); // 20240212
ta.now() ; // 20240213
ta.now() + ta.days(-1); // 20240211
ta.now() + ta.months(-1); // 20240112
one week from now
ta.now() + ta.weeks(1); //
ta.now() + ta.weeeks(-1); //
Comparisons
ta.now() === 20211208
let is\_one\_week\_from\_now\_after\_the\_last\_date = ta.now() + ta.weeks(1) > last_date;
if( is_one_week_from_now_after_the_last_date ) {
// logic
}
api
at.now(); // 20210212182902 at.seconds(1); // one second 0000000001 at.minutes(); // one minute at.days(); // one day at.weeeks(); // one week at.months(); // one month at.years(); // one month at.get_human_readable( date ); // 20210212182902 -> Feb 12th, 2021