donut-datetime
v1.0.3
Published
A DateTime object used in donut
Downloads
2
Readme
Literally just Date
with a few cool features.
const dt = new DateTime(<Whatever date you want | null>)
Adding Days
dt.addDays(8);
This can be done with seconds, minutes, hours, days, weeks, months, and years. use negative numbers to subtract.
Formatting String
const stringDate = dt.toFormatString("dd-MM-yyyy hh:mm:ssii");
Values are
d //Days with no "0" padding
dd //Days with "0" padding
ddd //First 3 characters of the actual day of the week: "Mon", "Tue"
dddd //Day of week: "Monday", "Tuesday"
M //Months with no "0" padding
MM //Months with "0" padding
MMM //First 3 characters of Month name: "Jan", "Feb"
MMMM //Full month name
yy //Last two digits of year
yyyy //Full year
h //Hours with no "0" padding
hh //Hours with "0" padding
m //Minutes with no "0" padding
mm //Minutes with "0" padding
s //Seconds with no "0" padding
ss //Seconds with "0" padding
ii //am or pm depending on time
Go nuts!