A Date library wrapper that extends the functionality of the built in javascript Date
object. It is
very lightweight and only relies on built in javascript functionality to wrap the date object.
A Date object wrapper that extends the date functionality
args
...any
Get the full year from the date
Time('10/10/2019').getFullYear() -> 2019
Returns Number The full year
Get the short year from the date
Time('10/10/2019').getFullYear() -> 19
Returns Number The last two digits of the year
Get the month from the current date
Time('10/10/2019').getMonth() -> October
Returns String Get the full month
Get the month from the current date
Time('10/10/2019').getMonth() -> Oct
Returns String Get the short month
Get the day of the month
Time('10/10/2019').getFullYear() -> 10
Returns Number The day of the month in the date object
Get the day of the month
Time('10/1/2019').hours() -> 01
Returns Number The day of the month in the date object
Get the hours of the current date
Time().hours() -> 0
Returns Number The hour of the current date
Get the long hours of the current date
Time().longHours() -> 00
Returns Number The hour of the current date
Get the minutes of the current date.
Time().minutes() -> 0
Returns Number The minutes of the current date
Get the long minutes of the current date.
Time().longMinutes() -> 00
Returns Number The minutes of the current date
Get the full year from the date
Time().getFullYear() -> 2019
Returns Number The full year
Get the day of the month
Time('10/1/2019').hours() -> 01
Returns Number The day of the month in the date object
format a string given a mask to format properties of the time object.
mask
(optional, default''
)
Time('10/1/2019').format('Y-m-D') -> '2019-October-1'
Returns String The formatted string
return when the date stored in the time object had occured relative to now.
Time('10/1/2019').when() -> '2 months ago (if todays month is august)'
Returns String the string containing when the date occurred relative to now.