just-another-date-library
v1.0.2
Published
A library that has a custom date object and additional Date methods
Downloads
4
Readme
Just Another Date Library
A library with some miscellaneous date things. Some methods were created with the intention of making them more clear. For example, Date.prototype.getMonth()
returning a month index vs month()
returning the actual name of the month, and Date.prototype.getDate()
sounding like it returns the whole date vs day()
actually returning the day of the month.
D Class
new D()
- A class that extends the Date prototype. D will have all the same Date prototype methods as well as new methods that do similar and new things.
D Methods
year()
- Returns the 4-digit year ofD
's date value.month()
- Returns the name of the month ofD
's date value.day()
- Returns the day of the month ofD
's date value.hour()
- Returns the hour of the day ofD
's date value.min()
- Returns the minute of the hours ofD
's date value.sec()
- Returns the second of the minute ofD
's date value.format(maskedStr)
- Returns a formatted string replacing characters in the string with date values.Y
- Y is replaced by the full yeary
- y is replaced by the last 2 digits of the yearM
- M is replaced by the full monthm
- m is replaced by the first 3 characters of the monthD
- D is replaced by the day, padded with 2 zerosd
- d is replaced by the day, without paddingH
- H is replaced by the hour, padded with 2 zerosh
- h is replaced by the hour, without paddingI
- I is replaced by the minute, padded with 2 zerosi
- i is replaced by the minute, without paddingS
- S is replaced by the second, padded with 2 zeross
- s is replaced by the second, without padding
when(now)
- Returns how much time has elapsed in either years, months, or days from thenow
parameter to the date value of theD
class.