diff -r 237e91a99f93 src/util_dateparser.js --- a/src/util_dateparser.js Tue Dec 14 09:34:48 2010 +0900 +++ b/src/util_dateparser.js Wed Dec 15 05:09:06 2010 +0900 @@ -46,7 +46,7 @@ * or the [AGPLv3] License.” */ -CSL.dateParser = function (txt) { +CSL.DateParser = function (txt) { var jiy_list, jiy, jiysplitter, jy, jmd, jr, pos, key, val, yearlast, yearfirst, number, rangesep, fuzzychar, chars, rex, rexdash, rexdashslash, rexslashdash, seasonstrs, seasonrexes, seasonstr, monthstrs, monthstr, monthrexes, seasonrex, len, jiymatchstring, jiymatcher; // instance object with private constants and a public function. @@ -115,16 +115,32 @@ seasonrexes.push(seasonrex); } + print("ok") // months - monthstrs = "jan feb mar apr may jun jul aug sep oct nov dec spr sum fal win spr sum"; - monthstrs = monthstrs.split(" "); + monthstrs = "january february march april may june july august september october november december spring summer fall winter spring summer"; + var lst = monthstrs.split(" "); + var monthstrs = []; + for (var i = 0, ilen = lst.length; i < ilen; i += 1) { + monthstrs.push([lst[i].slice(0, 3)]); + } monthrexes = []; len = monthstrs.length; for (pos = 0; pos < len; pos += 1) { monthstr = monthstrs[pos]; - rex = new RegExp(monthstr); + rex = new RegExp("(?:" + monthstr.join("|") + ")"); monthrexes.push(rex); } + this.monthrexes = monthrexes.slice(); + + this.resetMonths = function() { + this.monthrexes = monthrexes.slice(); + } + + this.addMonths = function(strs) { + // Something to stir in new month strings, checking + // for ambiguity across all values in the string + // sets, and extending strings as required. + } this.parse = function (txt) { var slash, dash, lst, l, m, number, note, thedate, slashcount, range_delim, date_delim, ret, delim_pos, delims, isrange, suff, date, breakme, item, pos, delim, ppos, element, pppos, len, llen, lllen, mm, slst, mmpos;