Open nas5w opened 5 years ago
I agree Dates need their own section and I really like your outline:
getTime
, getDate
, getFullYear
, getMonth (0 indexed!)
, etc.toLocaleDateString
)All of your toLocaleDateString
examples are good, but I think it's a bit too long because we'll want to include information in the other four subsections without taking up too much real estate. Perhaps the toLocaleDateString
section can have the en-US
and es-ES
examples you already provided, and then a sentence stating how there are many configuration options and a link to some docs (I like MDN).
I originally was going to suggest Dates in general within JS but then couldn't think of specific problems that I've come across over the years (how quickly one forgets). Either way, my suggestion using
toLocaleDateString
could be a subset of a broaderDates
category. Such a category could include:getTime
,getDate
,getFullYear
,getMonth (0 indexed!)
, etc.toLocaleDateString
)My original comment:
Something that I've found quite useful lately is Date formatting via
toLocaleDateString
.If you have a date that you want to format you can use this function in many ways. Example:
I'll admit the date options object can get a bit large but I've appreciated this over the confusing
strftime
formatting.