Simple second.
This is a project of changing the time counting system to a simpler form.
kSs
GitHub
Js library documentation for working with date and time in SS
The library consists of one Ss object, which has its own constructor, 1 property and 7 methods.
Property:
timestamp
Methods:
get
getYear
getMonth
getDay
getTime
add
subtract
timestap property
Timestamp is the time in milliSs that elapsed from the date "0-0-0 0.000" to the specified date. In the Gregorian calendar, this zero date is "1-1-1 00:00:00.000"
–°onstructor
new Ss([date])
date (optional) - This is a string specifying the date, the date must be written in the "y-m-d t" format. If the string does not match the given format, the constructor will return an error. y - year, m - month, d - day, t - time. Year, month, day, time, can be replaced with the word now, then this number will be replaced with the current one. For example "now-1-25 now" will return the 25th day of the 1st month of the current year with the current time. If the string does not exist, a date equivalent to "now-now-now now" (current date and time) will be created.
.get( ) method
new Ss( ).get( )
Returns the date in "y-m-d t" format as a string.
.getYear( ) method
new Ss( ).getYear( )
Returns the year of the date as a number.
.getMonth( ) method
new Ss( ).getMonth( )
Returns the month of year of the date as a number.
.getDay( ) method
new Ss( ).getDay( )
Returns the day of mounth of the date as a number.
.getTime( ) method
new Ss( ).getTime( )
Returns the time in ss of day of the date as a number.
.add( ) method
date1.add( date2 )
Returns the sum of two dates as an Ss object
.subtract( ) method
date1.subtract( date2 )
Returns the subtract (date1-date2) of two dates as an Ss object
.getDayOfYear( ) method
new Ss().dayOfYear()
Returns the day starting from the first day of the current year (counting from 0).
.getDayOfWeek( ) method
new Ss().dayOfWeek()
Returns the day starting from the first day of the current week (counting from 0).
.getWeek( ) method
new Ss().getWeek()
Returns the number of week starting from the first week of the current year (counting from 0).
Example
var date1 = new Ss();
var date2 = new Ss("2019-4-25 99000");

var subtract = date1.subtract(date2);

console.log(date1.get());
console.log(date2.get());
console.log(subtract.get());
console.log(subtract.getYear());
console.log(subtract.getMonth());
console.log(subtract.getDay());
console.log(subtract.getTime());