2017-11-10 199 views

回答

0

這應做到:

function getMonthsForLocale(locale) { 
    var format = new Intl.DateTimeFormat(locale, { month: 'long' }) 
    var months = [] 
    for (var m = 1; m <= 12; m++) { 
     var testDate = new Date(Date.UTC(2000, m, 1, 0, 0, 0)); 
     months.push(format.format(testDate)) 
    } 
    return months; 
} 
相關問題