OSDN Git Service

プロファイルの日付表示方法を変更した
authorkonekoneko <jbh03215@hotmail.co.jp>
Wed, 14 Nov 2012 07:34:29 +0000 (16:34 +0900)
committerkonekoneko <jbh03215@hotmail.co.jp>
Wed, 14 Nov 2012 07:34:29 +0000 (16:34 +0900)
これに伴いクライアント側も同じモジュールを使用するようにした

profile.js
public/chat.ejs
public/profile/list.ejs
public/scripts/chatclient.js
public/scripts/date-utils.min.js [new file with mode: 0644]
public/scripts/dateformat.js [deleted file]

index aec6b6b..61f4550 100644 (file)
@@ -10,12 +10,10 @@ $success_edit = "編集に成功しました";
 $notfound_name = "該当名が存在しません";\r
 \r
 var util = require("util");\r
-\r
 var async = require("async");\r
-\r
 var security = require("./security.js");\r
-\r
 var ejs = require("ejs");\r
+require("date-utils");\r
 \r
 var collection = new ProfileCollection();\r
 \r
@@ -56,6 +54,7 @@ function list_proc(req, res)
                        var prev = start - limit;\r
                        if(prev < 0)\r
                                prev = 0;\r
+                       result[0].lastmodified = result[0].lastmodified.toFormat("YYYY/MM/DD HH:MI:SS");\r
                        res.render("profile\\list",{list:result,search:parttern,next:next,prev:prev,limit:limit});\r
                }\r
        });\r
index 8797920..ac6ac66 100644 (file)
@@ -4,11 +4,11 @@
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r
 <!-- 独自のページを作る場合はここから -->\r
 <script type="text/javascript" src="/socket.io/socket.io.js"></script>\r
+<script type="text/javascript" src="scripts/date-utils.min.js"></script>\r
 <script type="text/javascript" src="scripts/jquery-1.8.1.min.js"></script>\r
 <script type="text/javascript" src="scripts/jquery.cookie.js"></script>\r
 <script type="text/javascript" src="scripts/bbcode.js"></script>\r
 <script type="text/javascript" src="scripts/sprintf.js"></script>\r
-<script type="text/javascript" src="scripts/dateformat.js"></script>\r
 <script type="text/javascript" src="scripts/commandparser.js"></script>\r
 <script type="text/javascript" src="scripts/dicecommand.js"></script>\r
 <script type="text/javascript" src="scripts/chatclient.js"></script>\r
index f7b063d..b54b9ea 100644 (file)
@@ -26,7 +26,7 @@
        <tr>\r
                <td><a href="profile/detail?name=<%= encodeURIComponent(list[i].name) %>"><%= list[i].name %></a></td>\r
                <td><%= list[i].age %></td>\r
-               <td><%= list[i].lastmodified %></td>\r
+               <td><%- list[i].lastmodified %></td>\r
        </tr>\r
 <% } %>\r
 </table>\r
index 66441c2..14c1f6c 100644 (file)
@@ -23,7 +23,6 @@ $prefix_filelist = "!";
 $socket = new Object();\r
 $names = {};\r
 $roominfo = {};\r
-$dateFormat = new DateFormat("yyyy/MM/dd HH:mm:ss");\r
 $romcount = 0;\r
 //ここまで\r
 \r
@@ -201,7 +200,7 @@ function ParseMessage(msg)
        trtag.append($("<td/>").append(namepart));\r
 \r
        msgpart = childtag\r
-               .append("(" + $dateFormat.format(date) +")")\r
+               .append("(" + date.toFormat("YYYY/MM/DD HH:MI:SS") +")")\r
                .css("color",color);\r
        trtag.append($("<td/>").append(msgpart));\r
 \r
diff --git a/public/scripts/date-utils.min.js b/public/scripts/date-utils.min.js
new file mode 100644 (file)
index 0000000..c7dd4b5
--- /dev/null
@@ -0,0 +1 @@
+(function(){function f(e,t){e=String(e);while(e.length<t)e="0"+e;return e}function d(e,t){Date.prototype[e]===undefined&&(Date.prototype[e]=t)}var e=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],t=["January","February","March","April","May","June","July","August","September","October","November","December"],n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],i={su:0,sun:0,sunday:0,mo:1,mon:1,monday:1,tu:2,tue:2,tuesday:2,we:3,wed:3,wednesday:3,th:4,thu:4,thursday:4,fr:5,fri:5,friday:5,sa:6,sat:6,saturday:6},s=t.concat(e),o=["su","sun","sunday","mo","mon","monday","tu","tue","tuesday","we","wed","wednesday","th","thu","thursday","fr","fri","friday","sa","sat","saturday"],u={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11},a=[31,28,31,30,31,30,31,31,30,31,30,31],l=function(e){return e.match(/^(\d+)$/)?!0:!1},c=function(e,t,n,r){for(var i=r;i>=n;i--){var s=e.substring(t,t+i);if(s.length<n)return null;if(l(s))return s}return null},h=Date.parse,p=function(e,t){e+="",t+="";var n=0,r=0,i="",u="",a="",f,l,h=new Date,p=h.getYear(),d=h.getMonth()+1,v=1,m=0,g=0,y=0,b="";while(r<t.length){i=t.charAt(r),u="";while(t.charAt(r)===i&&r<t.length)u+=t.charAt(r++);if(u==="yyyy"||u==="yy"||u==="y"){u==="yyyy"&&(f=4,l=4),u==="yy"&&(f=2,l=2),u==="y"&&(f=2,l=4),p=c(e,n,f,l);if(p===null)return NaN;n+=p.length,p.length===2&&(p>70?p=1900+(p-0):p=2e3+(p-0))}else if(u==="MMM"||u==="NNN"){d=0;for(var w=0;w<s.length;w++){var E=s[w];if(e.substring(n,n+E.length).toLowerCase()===E.toLowerCase())if(u==="MMM"||u==="NNN"&&w>11){d=w+1,d>12&&(d-=12),n+=E.length;break}}if(d<1||d>12)return NaN}else if(u==="EE"||u==="E")for(var S=0;S<o.length;S++){var x=o[S];if(e.substring(n,n+x.length).toLowerCase()===x.toLowerCase()){n+=x.length;break}}else if(u==="MM"||u==="M"){d=c(e,n,u.length,2);if(d===null||d<1||d>12)return NaN;n+=d.length}else if(u==="dd"||u==="d"){v=c(e,n,u.length,2);if(v===null||v<1||v>31)return NaN;n+=v.length}else if(u==="hh"||u==="h"){m=c(e,n,u.length,2);if(m===null||m<1||m>12)return NaN;n+=m.length}else if(u==="HH"||u==="H"){m=c(e,n,u.length,2);if(m===null||m<0||m>23)return NaN;n+=m.length}else if(u==="KK"||u==="K"){m=c(e,n,u.length,2);if(m===null||m<0||m>11)return NaN;n+=m.length}else if(u==="kk"||u==="k"){m=c(e,n,u.length,2);if(m===null||m<1||m>24)return NaN;n+=m.length,m--}else if(u==="mm"||u==="m"){g=c(e,n,u.length,2);if(g===null||g<0||g>59)return NaN;n+=g.length}else if(u==="ss"||u==="s"){y=c(e,n,u.length,2);if(y===null||y<0||y>59)return NaN;n+=y.length}else if(u==="a"){if(e.substring(n,n+2).toLowerCase()==="am")b="AM";else{if(e.substring(n,n+2).toLowerCase()!=="pm")return NaN;b="PM"}n+=2}else{if(e.substring(n,n+u.length)!==u)return NaN;n+=u.length}}if(n!==e.length)return NaN;if(d===2)if(p%4===0&&p%100!==0||p%400===0){if(v>29)return NaN}else if(v>28)return NaN;if(d===4||d===6||d===9||d===11)if(v>30)return NaN;m<12&&b==="PM"?m=m-0+12:m>11&&b==="AM"&&(m-=12);var T=new Date(p,d-1,v,m,g,y);return T.getTime()};Date.parse=function(e,t){if(t)return p(e,t);var n=h(e),r=0,i;return isNaN(n)&&(i=/^(\d{4}|[+\-]\d{6})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?))?/.exec(e))&&(i[8]!=="Z"&&(r=+i[10]*60+ +i[11],i[9]==="+"&&(r=0-r)),i[7]=i[7]||"000",n=Date.UTC(+i[1],+i[2]-1,+i[3],+i[4],+i[5]+r,+i[6],+i[7].substr(0,3))),n},Date.today=function(){return(new Date).clearTime()},Date.UTCtoday=function(){return(new Date).clearUTCTime()},Date.tomorrow=function(){return Date.today().add({days:1})},Date.UTCtomorrow=function(){return Date.UTCtoday().add({days:1})},Date.yesterday=function(){return Date.today().add({days:-1})},Date.UTCyesterday=function(){return Date.UTCtoday().add({days:-1})},Date.validateDay=function(e,t,n){var r=new Date(t,n,e);return r.getFullYear()===t&&r.getMonth()===n&&r.getDate()===e},Date.validateYear=function(e){return e>=0&&e<=9999},Date.validateSecond=function(e){return e>=0&&e<60},Date.validateMonth=function(e){return e>=0&&e<12},Date.validateMinute=function(e){return e>=0&&e<60},Date.validateMillisecond=function(e){return e>=0&&e<1e3},Date.validateHour=function(e){return e>=0&&e<24},Date.compare=function(e,t){return e.valueOf()<t.valueOf()?-1:e.valueOf()>t.valueOf()?1:0},Date.equals=function(e,t){return e.valueOf()===t.valueOf()},Date.getDayNumberFromName=function(e){return i[e.toLowerCase()]},Date.getMonthNumberFromName=function(e){return u[e.toLowerCase()]},Date.isLeapYear=function(e){return(new Date(e,1,29)).getDate()===29},Date.getDaysInMonth=function(e,t){return t===1?Date.isLeapYear(e)?29:28:a[t]},d("getMonthAbbr",function(){return e[this.getMonth()]}),d("getMonthName",function(){return t[this.getMonth()]}),d("getUTCOffset",function(){var e=f(Math.abs(this.getTimezoneOffset()/.6),4);return this.getTimezoneOffset()>0&&(e="-"+e),e}),d("toCLFString",function(){return f(this.getDate(),2)+"/"+this.getMonthAbbr()+"/"+this.getFullYear()+":"+f(this.getHours(),2)+":"+f(this.getMinutes(),2)+":"+f(this.getSeconds(),2)+" "+this.getUTCOffset()}),d("toYMD",function(e){return e=typeof e=="undefined"?"-":e,this.getFullYear()+e+f(this.getMonth()+1,2)+e+f(this.getDate(),2)}),d("toDBString",function(){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1,2)+"-"+f(this.getUTCDate(),2)+" "+f(this.getUTCHours(),2)+":"+f(this.getUTCMinutes(),2)+":"+f(this.getUTCSeconds(),2)}),d("clearTime",function(){return this.setHours(0),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0),this}),d("clearUTCTime",function(){return this.setUTCHours(0),this.setUTCMinutes(0),this.setUTCSeconds(0),this.setUTCMilliseconds(0),this}),d("add",function(e){return e.milliseconds!==undefined&&this.setMilliseconds(this.getMilliseconds()+e.milliseconds),e.seconds!==undefined&&this.setSeconds(this.getSeconds()+e.seconds),e.minutes!==undefined&&this.setMinutes(this.getMinutes()+e.minutes),e.hours!==undefined&&this.setHours(this.getHours()+e.hours),e.days!==undefined&&this.setDate(this.getDate()+e.days),e.weeks!==undefined&&this.setDate(this.getDate()+e.weeks*7),e.months!==undefined&&this.setMonth(this.getMonth()+e.months),e.years!==undefined&&this.setFullYear(this.getFullYear()+e.years),this}),d("addMilliseconds",function(e){return this.add({milliseconds:e})}),d("addSeconds",function(e){return this.add({seconds:e})}),d("addMinutes",function(e){return this.add({minutes:e})}),d("addHours",function(e){return this.add({hours:e})}),d("addDays",function(e){return this.add({days:e})}),d("addWeeks",function(e){return this.add({days:e*7})}),d("addMonths",function(e){return this.add({months:e})}),d("addYears",function(e){return this.add({years:e})}),d("setTimeToNow",function(){var e=new Date;this.setMilliseconds(e.getMilliseconds()),this.setSeconds(e.getSeconds()),this.setMinutes(e.getMinutes()),this.setHours(e.getHours())}),d("clone",function(){return new Date(this.valueOf())}),d("between",function(e,t){return this.valueOf()>=e.valueOf()&&this.valueOf()<=t.valueOf()}),d("compareTo",function(e){return Date.compare(this,e)}),d("equals",function(e){return Date.equals(this,e)}),d("isAfter",function(e){return e=e?e:new Date,this.compareTo(e)>0}),d("isBefore",function(e){return e=e?e:new Date,this.compareTo(e)<0}),d("getDaysBetween",function(e){return(e.clone().valueOf()-this.valueOf())/864e5|0}),d("getHoursBetween",function(e){return(e.clone().valueOf()-this.valueOf())/36e5|0}),d("getMinutesBetween",function(e){return(e.clone().valueOf()-this.valueOf())/6e4|0}),d("getSecondsBetween",function(e){return(e.clone().valueOf()-this.valueOf())/1e3|0}),d("getMillisecondsBetween",function(e){return e.clone().valueOf()-this.valueOf()|0}),d("getOrdinalNumber",function(){return Math.ceil((this.clone().clearTime()-new Date(this.getFullYear(),0,1))/864e5)+1}),d("toFormat",function(e){return v(e,m(this))}),d("toUTCFormat",function(e){return v(e,g(this))});var v=function(e,t){var n=[e],r,i,s,o=function(e,t){var r=0,i=n.length,s,o,u,a=[];for(;r<i;r++)if(typeof n[r]=="string"){u=n[r].split(e);for(s=0,o=u.length-1;s<o;s++)a.push(u[s]),a.push([t]);a.push(u[o])}else a.push(n[r]);n=a};for(r in t)o(r,t[r]);s="";for(r=0,i=n.length;r<i;r++)s+=typeof n[r]=="string"?n[r]:n[r][0];return n.join("")},m=function(i){var s=i.getHours()%12?i.getHours()%12:12;return{YYYY:i.getFullYear(),YY:String(i.getFullYear()).slice(-2),MMMM:t[i.getMonth()],MMM:e[i.getMonth()],MM:f(i.getMonth()+1,2),MI:f(i.getMinutes(),2),M:i.getMonth()+1,DDDD:r[i.getDay()],DDD:n[i.getDay()],DD:f(i.getDate(),2),D:i.getDate(),HH24:f(i.getHours(),2),HH:f(s,2),H:s,SS:f(i.getSeconds(),2),PP:i.getHours()>=12?"PM":"AM",P:i.getHours()>=12?"pm":"am",LL:f(i.getMilliseconds(),3)}},g=function(i){var s=i.getUTCHours()%12?i.getUTCHours()%12:12;return{YYYY:i.getUTCFullYear(),YY:String(i.getUTCFullYear()).slice(-2),MMMM:t[i.getUTCMonth()],MMM:e[i.getUTCMonth()],MM:f(i.getUTCMonth()+1,2),MI:f(i.getUTCMinutes(),2),M:i.getUTCMonth()+1,DDDD:r[i.getUTCDay()],DDD:n[i.getUTCDay()],DD:f(i.getUTCDate(),2),D:i.getUTCDate(),HH24:f(i.getUTCHours(),2),HH:f(s,2),H:s,SS:f(i.getUTCSeconds(),2),PP:i.getUTCHours()>=12?"PM":"AM",P:i.getUTCHours()>=12?"pm":"am",LL:f(i.getUTCMilliseconds(),3)}}})();
\ No newline at end of file
diff --git a/public/scripts/dateformat.js b/public/scripts/dateformat.js
deleted file mode 100644 (file)
index d9017db..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
---------------------------------------------------------
-dateformat.js - Simple date formatter
-Version 1.1 (Update 2008/04/02)
-
-Copyright (c) 2007-2008 onozaty (http://www.enjoyxstudy.com)
-
-Released under an MIT-style license.
-
-For details, see the web site:
- http://www.enjoyxstudy.com/javascript/dateformat/
-
---------------------------------------------------------
-patterns
-y : Year         ex. "yyyy" -> "2007", "yy" -> "07"
-M : Month        ex. "MM" -> "05" "12", "M" -> "5" "12"
-d : Day          ex. "dd" -> "09" "30", "d" -> "9" "30"
-H : Hour (0-23)  ex. "HH" -> "00" "23", "H" -> "0" "23"
-m : Minute       ex. "mm" -> "01" "59", "m" -> "1" "59"
-s : Second       ex. "ss" -> "00" "59", "H" -> "0" "59"
-S : Millisecond  ex. "SSS" -> "000" "012" "999", 
-                     "SS" -> "00" "12" "999", "S" -> "0" "12" "999"
-
-Text can be quoted using single quotes (') to avoid interpretation.
-"''" represents a single quote. 
-
-
-Useing..
-
- var fmt = new DateFormat("yyyy/MM/dd HH:mm:ss SSS");
-
- var str = fmt.format(new Date()); // "2007/05/10 12:21:19 002"
- var date = fmt.parse("2007/05/10 12:21:19 002"); // return Date object
-
---------------------------------------------------------
-*/
-
-var DateFormat = function(pattern) {
-  this._init(pattern);
-};
-
-DateFormat.prototype = {
-  _init: function(pattern) {
-
-    this.pattern = pattern;
-    this._patterns = [];
-
-    for (var i = 0; i < pattern.length; i++) {
-      var ch = pattern.charAt(i);
-      if (this._patterns.length == 0) {
-        this._patterns[0] = ch;
-      } else {
-        var index = this._patterns.length - 1;
-        if (this._patterns[index].charAt(0) == "'") {
-          if (this._patterns[index].length == 1 
-             || this._patterns[index].charAt(this._patterns[index].length - 1) != "'") {
-            this._patterns[index] += ch;
-          } else {
-            this._patterns[index + 1] = ch;
-          }
-        } else if (this._patterns[index].charAt(0) == ch) {
-          this._patterns[index] += ch;
-        } else {
-          this._patterns[index + 1] = ch;
-        }
-      }
-    }
-  },
-
-  format: function(date) {
-
-    var result = [];
-    for (var i = 0; i < this._patterns.length; i++) {
-      result[i] = this._formatWord(date, this._patterns[i]);
-    }
-    return result.join('');
-  },
-  _formatWord: function(date, pattern) {
-
-    var formatter = this._formatter[pattern.charAt(0)];
-    if (formatter) {
-      return formatter.apply(this, [date, pattern]);
-    } else {
-      return pattern;
-    }
-  },
-  _formatter: {
-    "y": function(date, pattern) {
-      // Year
-      var year = String(date.getFullYear());
-      if (pattern.length <= 2) {
-        year = year.substring(2, 4);
-      } else {
-        year = this._zeroPadding(year, pattern.length);
-      }
-      return year;
-    },
-    "M": function(date, pattern) {
-      // Month in year
-      return this._zeroPadding(String(date.getMonth() + 1), pattern.length);
-    },
-    "d": function(date, pattern) {
-      // Day in month
-      return this._zeroPadding(String(date.getDate()), pattern.length);
-    },
-    "H": function(date, pattern) {
-      // Hour in day (0-23)
-      return this._zeroPadding(String(date.getHours()), pattern.length);
-    },
-    "m": function(date, pattern) {
-      // Minute in hour
-      return this._zeroPadding(String(date.getMinutes()), pattern.length);
-    },
-    "s": function(date, pattern) {
-      // Second in minute
-      return this._zeroPadding(String(date.getSeconds()), pattern.length);
-    },
-    "S": function(date, pattern) {
-      // Millisecond
-      return this._zeroPadding(String(date.getMilliseconds()), pattern.length);
-    },
-    "'": function(date, pattern) {
-      // escape
-      if (pattern == "''") {
-        return "'";
-      } else {
-        return pattern.replace(/'/g, '');
-      }
-    }
-  },
-
-  _zeroPadding: function(str, length) {
-    if (str.length >= length) {
-      return str;
-    }
-
-    return new Array(length - str.length + 1).join("0") + str;
-  },
-
-
-  /// Parser ///
-  parse: function(text) {
-
-    if (typeof text != 'string' || text == '') return null;
-
-    var result = {year: 1970, month: 1, day: 1, hour: 0, min: 0, sec: 0, msec: 0};
-
-    for (var i = 0; i < this._patterns.length; i++) {
-       if (text == '') return null; // parse error!!
-       text = this._parseWord(text, this._patterns[i], result);
-       if (text === null) return null; // parse error!!
-    }
-    if (text != '') return null; // parse error!!
-
-    return new Date(
-                result.year,
-                result.month - 1,
-                result.day,
-                result.hour,
-                result.min,
-                result.sec,
-                result.msec);
-  },
-  _parseWord: function(text, pattern, result) {
-
-    var parser = this._parser[pattern.charAt(0)];
-    if (parser) {
-      return parser.apply(this, [text, pattern, result]);
-    } else {
-      if (text.indexOf(pattern) != 0) {
-        return null;
-      } else {
-        return text.substring(pattern.length);
-      }
-    }
-  },
-  _parser: {
-    "y": function(text, pattern, result) {
-      // Year
-      var year;
-      if (pattern.length <= 2) {
-        year = text.substring(0, 2);
-        year = year < 70 ? '20' + year : '19' + year;
-        text = text.substring(2);
-      } else {
-        var length = (pattern.length == 3) ? 4 : pattern.length;
-        year = text.substring(0, length);
-        text = text.substring(length);
-      }
-      if (!this._isNumber(year)) return null; // error
-      result.year = parseInt(year, 10);
-      return text;
-    },
-    "M": function(text, pattern, result) {
-      // Month in year
-      var month;
-      if (pattern.length == 1 && text.length > 1
-          && text.substring(0, 2).match(/1[0-2]/) != null) {
-        month = text.substring(0, 2);
-        text  = text.substring(2);
-      } else {
-        month = text.substring(0, pattern.length);
-        text  = text.substring(pattern.length);
-      }
-      if (!this._isNumber(month)) return null; // error
-      result.month = parseInt(month, 10);
-      return text;
-    },
-    "d": function(text, pattern, result) {
-      // Day in month
-      var day;
-      if (pattern.length == 1 && text.length > 1 
-          && text.substring(0, 2).match(/1[0-9]|2[0-9]|3[0-1]/) != null) {
-        day  = text.substring(0, 2);
-        text = text.substring(2);
-      } else {
-        day  = text.substring(0, pattern.length);
-        text = text.substring(pattern.length);
-      }
-      if (!this._isNumber(day)) return null; // error
-      result.day = parseInt(day, 10);
-      return text;
-    },
-    "H": function(text, pattern, result) {
-      // Hour in day (0-23)
-      var hour;
-      if (pattern.length == 1 && text.length > 1
-          && text.substring(0, 2).match(/1[0-9]|2[0-3]/) != null) {
-        hour = text.substring(0, 2);
-        text = text.substring(2);
-      } else {
-        hour = text.substring(0, pattern.length);
-        text = text.substring(pattern.length);
-      }
-      if (!this._isNumber(hour)) return null; // error
-      result.hour = parseInt(hour, 10);
-      return text;
-    },
-    "m": function(text, pattern, result) {
-      // Minute in hour
-      var min;
-      if (pattern.length == 1 && text.length > 1
-          && text.substring(0, 2).match(/[1-5][0-9]/) != null) {
-        min  = text.substring(0, 2);
-        text = text.substring(2);
-      } else {
-        min  = text.substring(0, pattern.length);
-        text = text.substring(pattern.length);
-      }
-      if (!this._isNumber(min)) return null; // error
-      result.min = parseInt(min, 10);
-      return text;
-    },
-    "s": function(text, pattern, result) {
-      // Second in minute
-      var sec;
-      if (pattern.length == 1 && text.length > 1
-          && text.substring(0, 2).match(/[1-5][0-9]/) != null) {
-        sec  = text.substring(0, 2);
-        text = text.substring(2);
-      } else {
-        sec  = text.substring(0, pattern.length);
-        text = text.substring(pattern.length);
-      }
-      if (!this._isNumber(sec)) return null; // error
-      result.sec = parseInt(sec, 10);
-      return text;
-    },
-    "S": function(text, pattern, result) {
-      // Millimsecond
-      var msec;
-      if (pattern.length == 1 || pattern.length == 2) {
-        if (text.length > 2 && text.substring(0, 3).match(/[1-9][0-9][0-9]/) != null) {
-          msec = text.substring(0, 3);
-          text = text.substring(3);
-        } else if (text.length > 1 && text.substring(0, 2).match(/[1-9][0-9]/) != null) {
-          msec = text.substring(0, 2);
-          text = text.substring(2);
-        } else {
-          msec = text.substring(0, pattern.length);
-          text = text.substring(pattern.length);
-        }
-      } else {
-        msec = text.substring(0, pattern.length);
-        text = text.substring(pattern.length);
-      }
-      if (!this._isNumber(msec)) return null; // error
-      result.msec = parseInt(msec, 10);
-      return text;
-    },
-    "'": function(text, pattern, result) {
-      // escape
-      if (pattern == "''") {
-        pattern = "'";
-      } else {
-        pattern = pattern.replace(/'/g, '');
-      }
-      if (text.indexOf(pattern) != 0) {
-        return null; // error
-      } else {
-        return text.substring(pattern.length);
-      }
-    }
-  },
-
-  _isNumber: function(str) {
-    return /^[0-9]*$/.test(str);
-  }
-}