fix for lowercase months in non-English locales
This commit is contained in:
parent
5fd473b64f
commit
72a511ba81
1 changed files with 6 additions and 4 deletions
|
@ -330,12 +330,14 @@ Zotero.Date = new function(){
|
||||||
// MONTH
|
// MONTH
|
||||||
if(!date.month) {
|
if(!date.month) {
|
||||||
// compile month regular expression
|
// compile month regular expression
|
||||||
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
|
var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul',
|
||||||
'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
'aug', 'sep', 'oct', 'nov', 'dec'];
|
||||||
// If using a non-English bibliography locale, try those too
|
// If using a non-English bibliography locale, try those too
|
||||||
if (Zotero.locale != 'en-US') {
|
if (Zotero.locale != 'en-US') {
|
||||||
months = months.concat(Zotero.Date.months.short);
|
months = months.concat(Zotero.Date.months.short).concat(Zotero.Date.months.long);
|
||||||
|
for(var i in months) months[i] = months[i].toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_monthRe) {
|
if(!_monthRe) {
|
||||||
_monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]*(?: (.*)$|$)", "i");
|
_monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]*(?: (.*)$|$)", "i");
|
||||||
}
|
}
|
||||||
|
@ -343,7 +345,7 @@ Zotero.Date = new function(){
|
||||||
var m = _monthRe.exec(date.part);
|
var m = _monthRe.exec(date.part);
|
||||||
if(m) {
|
if(m) {
|
||||||
// Modulo 12 in case we have multiple languages
|
// Modulo 12 in case we have multiple languages
|
||||||
date.month = months.indexOf(m[2][0].toUpperCase()+m[2].substr(1).toLowerCase()) % 12;
|
date.month = months.indexOf(m[2].toLowerCase()) % 12;
|
||||||
date.part = m[1]+m[3];
|
date.part = m[1]+m[3];
|
||||||
Zotero.debug("DATE: got month ("+date.month+", "+date.part+")");
|
Zotero.debug("DATE: got month ("+date.month+", "+date.part+")");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue