Sugar.js Date: equivalent to moment.months()? to get a list of all months

157 views Asked by At

What´s the equivalent to moment.months() and moment.weekdaysShort()?

moment.months()
["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]

moment.weekdaysShort()
["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]

The closest I´ve fond so far is this, Isn´t there a cleaner version?

Date.getLocale().months
["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december", 
"jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"]
1

There are 1 answers

0
thomasf1 On

For now, I´m doing this in CS:

(m[0].toUpperCase() + m[1..-1] for m in Date.getLocale().months[0..11])