www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 72a511ba816ab848e677d25fa58152d119d7c928
parent 5fd473b64f68730eff970357cbefd2167c38226c
Author: Simon Kornblith <simon@simonster.com>
Date:   Fri, 18 Mar 2011 08:26:55 +0000

fix for lowercase months in non-English locales


Diffstat:
Mchrome/content/zotero/xpcom/date.js | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/date.js b/chrome/content/zotero/xpcom/date.js @@ -330,12 +330,14 @@ Zotero.Date = new function(){ // MONTH if(!date.month) { // compile month regular expression - var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', - 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', + 'aug', 'sep', 'oct', 'nov', 'dec']; // If using a non-English bibliography locale, try those too 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) { _monthRe = new RegExp("^(.*)\\b("+months.join("|")+")[^ ]*(?: (.*)$|$)", "i"); } @@ -343,7 +345,7 @@ Zotero.Date = new function(){ var m = _monthRe.exec(date.part); if(m) { // 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]; Zotero.debug("DATE: got month ("+date.month+", "+date.part+")"); }