0

什么相当于 moment.months() 和 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"]

到目前为止我最喜欢的是这个,没有更清洁的版本吗?

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"]
4

1 回答 1

0

现在,我在 CS 中这样做:

(m[0].toUpperCase() + m[1..-1] for m in Date.getLocale().months[0..11])
于 2014-04-10T09:36:12.777 回答