summaryrefslogtreecommitdiff
path: root/js/dojo-1.6/dojox/date/buddhist
diff options
context:
space:
mode:
Diffstat (limited to 'js/dojo-1.6/dojox/date/buddhist')
-rw-r--r--js/dojo-1.6/dojox/date/buddhist/Date.js321
-rw-r--r--js/dojo-1.6/dojox/date/buddhist/Date.xd.js325
-rw-r--r--js/dojo-1.6/dojox/date/buddhist/locale.js429
-rw-r--r--js/dojo-1.6/dojox/date/buddhist/locale.xd.js438
4 files changed, 1513 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/date/buddhist/Date.js b/js/dojo-1.6/dojox/date/buddhist/Date.js
new file mode 100644
index 0000000..e2d2cc5
--- /dev/null
+++ b/js/dojo-1.6/dojox/date/buddhist/Date.js
@@ -0,0 +1,321 @@
+/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.date.buddhist.Date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.date.buddhist.Date"] = true;
+dojo.provide("dojox.date.buddhist.Date");
+dojo.experimental("dojox.date.buddhist.Date");
+
+dojo.declare("dojox.date.buddhist.Date", null, {
+
+ _date: 0,
+ _month: 0,
+ _year: 0,
+ _hours: 0,
+ _minutes: 0,
+ _seconds: 0,
+ _milliseconds: 0,
+ _day: 0,
+
+ constructor: function(){
+ // summary: This is the constructor
+ // description:
+ // This fucntion initialize the date object values
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | var date2 = new dojox.date.buddhist.Date(date1);
+ // |
+ // | var date3 = new dojox.date.buddhist.Date(2552,2,12);
+ var len = arguments.length;
+ if(!len){// use the current date value, added "" to the similarity to date
+ this.fromGregorian(new Date());
+ }else if(len == 1){
+ var arg0 = arguments[0];
+ if(typeof arg0 == "number"){ // this is time "valueof"
+ arg0 = new Date(arg0);
+ }
+
+ if(arg0 instanceof Date){
+ this.fromGregorian(arg0);
+ }else if(arg0 == ""){
+ this._date = new Date("");
+ }else{
+ this._year = arg0._year;
+ this._month = arg0._month;
+ this._date = arg0._date;
+ this._hours = arg0._hours;
+ this._minutes = arg0._minutes;
+ this._seconds = arg0._seconds;
+ this._milliseconds = arg0._milliseconds;
+ }
+ }else if(len >=3){
+ this._year += arguments[0];
+ this._month += arguments[1];
+ this._date += arguments[2];
+
+ if(this._month >11){
+ console.warn("the month is incorrect , set 0");
+ this._month = 0;
+ }
+ this._hours += arguments[3] || 0;
+ this._minutes += arguments[4] || 0;
+ this._seconds += arguments[5] || 0;
+ this._milliseconds += arguments[6] || 0;
+ }
+ },
+
+ getDate: function(/*boolean?*/isNumber){
+ // summary: This function returns the date value (0 - 30)
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | console.log(date1.getDate());
+ return parseInt(this._date);
+ },
+
+ getMonth: function(){
+ // summary: This function return the month value ( 0 - 11 )
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | console.log(date1.getMonth()+1);
+ return parseInt(this._month);
+ },
+
+
+ getFullYear: function(){
+ // summary: This function return the Year value
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | console.log(date1.getFullYear());
+ return parseInt(this._year);
+ },
+
+ getHours: function(){
+ //summary: returns the Hour value
+ return this._hours;
+ },
+
+ getMinutes: function(){
+ //summary: returns the Minuites value
+ return this._minutes;
+ },
+
+ getSeconds: function(){
+ //summary: returns the seconde value
+ return this._seconds;
+ },
+
+ getMilliseconds: function(){
+ //summary: returns the Milliseconds value
+ return this._milliseconds;
+ },
+
+ setDate: function(/*number*/date){
+ // summary: This function sets the Date
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // | date1.setDate(2);
+ date = parseInt(date);
+
+ if(date > 0 && date <= this._getDaysInMonth(this._month, this._year)){
+ this._date = date;
+ }else{
+ var mdays;
+ if(date>0){
+ for(mdays = this._getDaysInMonth(this._month, this._year);
+ date > mdays;
+ date -= mdays,mdays = this._getDaysInMonth(this._month, this._year)){
+ this._month++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ }
+
+ this._date = date;
+ }else{
+ for(mdays = this._getDaysInMonth((this._month-1)>=0 ?(this._month-1) :11 ,((this._month-1)>=0)? this._year: this._year-1);
+ date <= 0;
+ mdays = this._getDaysInMonth((this._month-1)>=0 ? (this._month-1) :11,((this._month-1)>=0)? this._year: this._year-1)){
+ this._month--;
+ if(this._month < 0){this._year--; this._month += 12;}
+
+ date+=mdays;
+ }
+ this._date = date;
+ }
+ }
+ return this;
+ },
+
+ setFullYear: function(/*number*/year, /*number?*/month, /*number?*/ date){
+ // summary: This function set Year
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // | date1.setFullYear(2552);
+ // | date1.setFullYear(2552, 1, 1);
+ this._year = parseInt(year);
+ },
+
+ setMonth: function(/*number*/month){
+ // summary: This function set Month
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // | date1.setMonth(0); //first month
+ this._year += Math.floor(month / 12);
+ this._month = Math.floor(month % 12);
+ for(; this._month < 0; this._month = this._month+12);
+ },
+
+ setHours: function(){
+ //summary: set the Hours 0-23
+ var hours_arg_no = arguments.length;
+ var hours = 0;
+ if(hours_arg_no >= 1){
+ hours = parseInt(arguments[0]);
+ }
+
+ if(hours_arg_no >= 2){
+ this._minutes = parseInt(arguments[1]);
+ }
+
+ if(hours_arg_no >= 3){
+ this._seconds = parseInt(arguments[2]);
+ }
+
+ if(hours_arg_no == 4){
+ this._milliseconds = parseInt(arguments[3]);
+ }
+
+ while(hours >= 24){
+ this._date++;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ hours -= 24;
+ }
+ this._hours = hours;
+ },
+
+ setMinutes: function(/*number*/minutes){
+ //summary: set the Minutes frm 0-59
+ while(minutes >= 60){
+ this._hours++;
+ if(this._hours >= 24){
+ this._date++;
+ this._hours -= 24;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ }
+ minutes -= 60;
+ }
+ this._minutes = minutes;
+ },
+
+ setSeconds: function(/*number*/seconds){
+ //summary: set the Seconds from 0-59
+ while(seconds >= 60){
+ this._minutes++;
+ if(this._minutes >= 60){
+ this._hours++;
+ this._minutes -= 60;
+ if(this._hours >= 24){
+ this._date++;
+ this._hours -= 24;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ }
+ }
+ seconds -= 60;
+ }
+ this._seconds = seconds;
+ },
+
+ setMilliseconds: function(/*number*/milliseconds){
+ //summary: set the milliseconds
+ while(milliseconds >= 1000){
+ this.setSeconds++;
+ if(this.setSeconds >= 60){
+ this._minutes++;
+ this.setSeconds -= 60;
+ if(this._minutes >= 60){
+ this._hours++;
+ this._minutes -= 60;
+ if(this._hours >= 24){
+ this._date++;
+ this._hours -= 24;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ }
+ }
+ }
+ milliseconds -= 1000;
+ }
+ this._milliseconds = milliseconds;
+ },
+
+ toString: function(){
+ // summary: This returns a string representation of the date in "dd, MM, YYYY HH:MM:SS" format
+ return this._date + ", " + this._month + ", " + this._year + " " + this._hours + ":" + this._minutes + ":" + this._seconds; // String
+ },
+
+//FIXME: remove this and replace usage with dojox.date.buddhist.getDaysInMonth?
+ _getDaysInMonth: function(/*number*/month, /*number*/ year){
+ return dojo.date.getDaysInMonth(new Date(year-543, month));
+ },
+
+ fromGregorian: function(/*Date*/gdate){
+ // summary: This function sets this Date to the Hebrew Date corresponding to the Gregorian Date
+ var date = new Date(gdate);
+ this._date = date.getDate();
+ this._month = date.getMonth();
+ this._year = date.getFullYear()+543;
+ this._hours = date.getHours();
+ this._minutes = date.getMinutes();
+ this._seconds = date.getSeconds();
+ this._milliseconds = date.getMilliseconds();
+ this._day = date.getDay();
+ return this;
+ },
+
+ toGregorian: function(){
+ // summary: This returns the equivalent Gregorian date value as a Date object
+ return new Date(this._year-543, this._month, this._date, this._hours, this._minutes, this._seconds, this._milliseconds); // Date
+ },
+
+ getDay: function(){
+ // summary: This function return Week Day value ( 0 - 6 )
+ return this.toGregorian().getDay(); // int
+ }
+});
+
+dojox.date.buddhist.Date.prototype.valueOf = function(){
+ return this.toGregorian().valueOf();
+};
+
+}
diff --git a/js/dojo-1.6/dojox/date/buddhist/Date.xd.js b/js/dojo-1.6/dojox/date/buddhist/Date.xd.js
new file mode 100644
index 0000000..91bcb47
--- /dev/null
+++ b/js/dojo-1.6/dojox/date/buddhist/Date.xd.js
@@ -0,0 +1,325 @@
+/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.date.buddhist.Date"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.date.buddhist.Date"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.date.buddhist.Date"] = true;
+dojo.provide("dojox.date.buddhist.Date");
+dojo.experimental("dojox.date.buddhist.Date");
+
+dojo.declare("dojox.date.buddhist.Date", null, {
+
+ _date: 0,
+ _month: 0,
+ _year: 0,
+ _hours: 0,
+ _minutes: 0,
+ _seconds: 0,
+ _milliseconds: 0,
+ _day: 0,
+
+ constructor: function(){
+ // summary: This is the constructor
+ // description:
+ // This fucntion initialize the date object values
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | var date2 = new dojox.date.buddhist.Date(date1);
+ // |
+ // | var date3 = new dojox.date.buddhist.Date(2552,2,12);
+ var len = arguments.length;
+ if(!len){// use the current date value, added "" to the similarity to date
+ this.fromGregorian(new Date());
+ }else if(len == 1){
+ var arg0 = arguments[0];
+ if(typeof arg0 == "number"){ // this is time "valueof"
+ arg0 = new Date(arg0);
+ }
+
+ if(arg0 instanceof Date){
+ this.fromGregorian(arg0);
+ }else if(arg0 == ""){
+ this._date = new Date("");
+ }else{
+ this._year = arg0._year;
+ this._month = arg0._month;
+ this._date = arg0._date;
+ this._hours = arg0._hours;
+ this._minutes = arg0._minutes;
+ this._seconds = arg0._seconds;
+ this._milliseconds = arg0._milliseconds;
+ }
+ }else if(len >=3){
+ this._year += arguments[0];
+ this._month += arguments[1];
+ this._date += arguments[2];
+
+ if(this._month >11){
+ console.warn("the month is incorrect , set 0");
+ this._month = 0;
+ }
+ this._hours += arguments[3] || 0;
+ this._minutes += arguments[4] || 0;
+ this._seconds += arguments[5] || 0;
+ this._milliseconds += arguments[6] || 0;
+ }
+ },
+
+ getDate: function(/*boolean?*/isNumber){
+ // summary: This function returns the date value (0 - 30)
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | console.log(date1.getDate());
+ return parseInt(this._date);
+ },
+
+ getMonth: function(){
+ // summary: This function return the month value ( 0 - 11 )
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | console.log(date1.getMonth()+1);
+ return parseInt(this._month);
+ },
+
+
+ getFullYear: function(){
+ // summary: This function return the Year value
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // |
+ // | console.log(date1.getFullYear());
+ return parseInt(this._year);
+ },
+
+ getHours: function(){
+ //summary: returns the Hour value
+ return this._hours;
+ },
+
+ getMinutes: function(){
+ //summary: returns the Minuites value
+ return this._minutes;
+ },
+
+ getSeconds: function(){
+ //summary: returns the seconde value
+ return this._seconds;
+ },
+
+ getMilliseconds: function(){
+ //summary: returns the Milliseconds value
+ return this._milliseconds;
+ },
+
+ setDate: function(/*number*/date){
+ // summary: This function sets the Date
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // | date1.setDate(2);
+ date = parseInt(date);
+
+ if(date > 0 && date <= this._getDaysInMonth(this._month, this._year)){
+ this._date = date;
+ }else{
+ var mdays;
+ if(date>0){
+ for(mdays = this._getDaysInMonth(this._month, this._year);
+ date > mdays;
+ date -= mdays,mdays = this._getDaysInMonth(this._month, this._year)){
+ this._month++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ }
+
+ this._date = date;
+ }else{
+ for(mdays = this._getDaysInMonth((this._month-1)>=0 ?(this._month-1) :11 ,((this._month-1)>=0)? this._year: this._year-1);
+ date <= 0;
+ mdays = this._getDaysInMonth((this._month-1)>=0 ? (this._month-1) :11,((this._month-1)>=0)? this._year: this._year-1)){
+ this._month--;
+ if(this._month < 0){this._year--; this._month += 12;}
+
+ date+=mdays;
+ }
+ this._date = date;
+ }
+ }
+ return this;
+ },
+
+ setFullYear: function(/*number*/year, /*number?*/month, /*number?*/ date){
+ // summary: This function set Year
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // | date1.setFullYear(2552);
+ // | date1.setFullYear(2552, 1, 1);
+ this._year = parseInt(year);
+ },
+
+ setMonth: function(/*number*/month){
+ // summary: This function set Month
+ //
+ // example:
+ // | var date1 = new dojox.date.buddhist.Date();
+ // | date1.setMonth(0); //first month
+ this._year += Math.floor(month / 12);
+ this._month = Math.floor(month % 12);
+ for(; this._month < 0; this._month = this._month+12);
+ },
+
+ setHours: function(){
+ //summary: set the Hours 0-23
+ var hours_arg_no = arguments.length;
+ var hours = 0;
+ if(hours_arg_no >= 1){
+ hours = parseInt(arguments[0]);
+ }
+
+ if(hours_arg_no >= 2){
+ this._minutes = parseInt(arguments[1]);
+ }
+
+ if(hours_arg_no >= 3){
+ this._seconds = parseInt(arguments[2]);
+ }
+
+ if(hours_arg_no == 4){
+ this._milliseconds = parseInt(arguments[3]);
+ }
+
+ while(hours >= 24){
+ this._date++;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ hours -= 24;
+ }
+ this._hours = hours;
+ },
+
+ setMinutes: function(/*number*/minutes){
+ //summary: set the Minutes frm 0-59
+ while(minutes >= 60){
+ this._hours++;
+ if(this._hours >= 24){
+ this._date++;
+ this._hours -= 24;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ }
+ minutes -= 60;
+ }
+ this._minutes = minutes;
+ },
+
+ setSeconds: function(/*number*/seconds){
+ //summary: set the Seconds from 0-59
+ while(seconds >= 60){
+ this._minutes++;
+ if(this._minutes >= 60){
+ this._hours++;
+ this._minutes -= 60;
+ if(this._hours >= 24){
+ this._date++;
+ this._hours -= 24;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ }
+ }
+ seconds -= 60;
+ }
+ this._seconds = seconds;
+ },
+
+ setMilliseconds: function(/*number*/milliseconds){
+ //summary: set the milliseconds
+ while(milliseconds >= 1000){
+ this.setSeconds++;
+ if(this.setSeconds >= 60){
+ this._minutes++;
+ this.setSeconds -= 60;
+ if(this._minutes >= 60){
+ this._hours++;
+ this._minutes -= 60;
+ if(this._hours >= 24){
+ this._date++;
+ this._hours -= 24;
+ var mdays = this._getDaysInMonth(this._month, this._year);
+ if(this._date > mdays){
+ this._month ++;
+ if(this._month >= 12){this._year++; this._month -= 12;}
+ this._date -= mdays;
+ }
+ }
+ }
+ }
+ milliseconds -= 1000;
+ }
+ this._milliseconds = milliseconds;
+ },
+
+ toString: function(){
+ // summary: This returns a string representation of the date in "dd, MM, YYYY HH:MM:SS" format
+ return this._date + ", " + this._month + ", " + this._year + " " + this._hours + ":" + this._minutes + ":" + this._seconds; // String
+ },
+
+//FIXME: remove this and replace usage with dojox.date.buddhist.getDaysInMonth?
+ _getDaysInMonth: function(/*number*/month, /*number*/ year){
+ return dojo.date.getDaysInMonth(new Date(year-543, month));
+ },
+
+ fromGregorian: function(/*Date*/gdate){
+ // summary: This function sets this Date to the Hebrew Date corresponding to the Gregorian Date
+ var date = new Date(gdate);
+ this._date = date.getDate();
+ this._month = date.getMonth();
+ this._year = date.getFullYear()+543;
+ this._hours = date.getHours();
+ this._minutes = date.getMinutes();
+ this._seconds = date.getSeconds();
+ this._milliseconds = date.getMilliseconds();
+ this._day = date.getDay();
+ return this;
+ },
+
+ toGregorian: function(){
+ // summary: This returns the equivalent Gregorian date value as a Date object
+ return new Date(this._year-543, this._month, this._date, this._hours, this._minutes, this._seconds, this._milliseconds); // Date
+ },
+
+ getDay: function(){
+ // summary: This function return Week Day value ( 0 - 6 )
+ return this.toGregorian().getDay(); // int
+ }
+});
+
+dojox.date.buddhist.Date.prototype.valueOf = function(){
+ return this.toGregorian().valueOf();
+};
+
+}
+
+}};});
diff --git a/js/dojo-1.6/dojox/date/buddhist/locale.js b/js/dojo-1.6/dojox/date/buddhist/locale.js
new file mode 100644
index 0000000..9c9a48e
--- /dev/null
+++ b/js/dojo-1.6/dojox/date/buddhist/locale.js
@@ -0,0 +1,429 @@
+/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.date.buddhist.locale"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.date.buddhist.locale"] = true;
+dojo.provide("dojox.date.buddhist.locale");
+dojo.experimental("dojox.date.buddhist.locale");
+
+dojo.require("dojox.date.buddhist.Date");
+dojo.require("dojo.regexp");
+dojo.require("dojo.string");
+dojo.require("dojo.i18n");
+
+dojo.requireLocalization("dojo.cldr", "buddhist", null, "ROOT,ar,da,de,el,en,en-gb,es,fi,ro,th,zh-hant");
+
+(function(){
+ // Format a pattern without literals
+ function formatPattern(dateObject, bundle, locale, fullYear, pattern){
+
+ return pattern.replace(/([a-z])\1*/ig, function(match){
+ var s, pad;
+ var c = match.charAt(0);
+ var l = match.length;
+ var widthList = ["abbr", "wide", "narrow"];
+
+ switch(c){
+ case 'G':
+ s = bundle["eraAbbr"][0];
+ break;
+ case 'y':
+ s = String(dateObject.getFullYear());
+ break;
+ case 'M':
+ var m = dateObject.getMonth();
+ if(l<3){
+ s = m+1; pad = true;
+ }else{
+ var propM = ["months", "format", widthList[l-3]].join("-");
+ s = bundle[propM][m];
+ }
+ break;
+ case 'd':
+ s = dateObject.getDate(true); pad = true;
+ break;
+ case 'E':
+ var d = dateObject.getDay();
+ if(l<3){
+ s = d+1; pad = true;
+ }else{
+ var propD = ["days", "format", widthList[l-3]].join("-");
+ s = bundle[propD][d];
+ }
+ break;
+ case 'a':
+ var timePeriod = (dateObject.getHours() < 12) ? 'am' : 'pm';
+ s = bundle['dayPeriods-format-wide-' + timePeriod];
+ break;
+ case 'h':
+ case 'H':
+ case 'K':
+ case 'k':
+ var h = dateObject.getHours();
+ switch (c){
+ case 'h': // 1-12
+ s = (h % 12) || 12;
+ break;
+ case 'H': // 0-23
+ s = h;
+ break;
+ case 'K': // 0-11
+ s = (h % 12);
+ break;
+ case 'k': // 1-24
+ s = h || 24;
+ break;
+ }
+ pad = true;
+ break;
+ case 'm':
+ s = dateObject.getMinutes(); pad = true;
+ break;
+ case 's':
+ s = dateObject.getSeconds(); pad = true;
+ break;
+ case 'S':
+ s = Math.round(dateObject.getMilliseconds() * Math.pow(10, l-3)); pad = true;
+ break;
+ case 'z':
+ // We only have one timezone to offer; the one from the browser
+ s = dojo.date.getTimezoneName(dateObject.toGregorian());
+ if(s){ break; }
+ l = 4;
+ // fallthrough... use GMT if tz not available
+ case 'Z':
+ var offset = dateObject.toGregorian().getTimezoneOffset();
+ var tz = [
+ (offset <= 0 ? "+" : "-"),
+ dojo.string.pad(Math.floor(Math.abs(offset) / 60), 2),
+ dojo.string.pad(Math.abs(offset) % 60, 2)
+ ];
+ if(l == 4){
+ tz.splice(0, 0, "GMT");
+ tz.splice(3, 0, ":");
+ }
+ s = tz.join("");
+ break;
+ default:
+ throw new Error("dojox.date.buddhist.locale.formatPattern: invalid pattern char: "+pattern);
+ }
+ if(pad){ s = dojo.string.pad(s, l); }
+ return s;
+ });
+ }
+
+dojox.date.buddhist.locale.format = function(/*buddhist.Date*/dateObject, /*object?*/options){
+ // based on and similar to dojo.date.locale.format
+ //summary:
+ // Format a Date object as a String, using settings.
+ options = options || {};
+
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+ var formatLength = options.formatLength || 'short';
+ var bundle = dojox.date.buddhist.locale._getBuddhistBundle(locale);
+ var str = [];
+
+ var sauce = dojo.hitch(this, formatPattern, dateObject, bundle, locale, options.fullYear);
+ if(options.selector == "year"){
+ var year = dateObject.getFullYear();
+ return year;
+ }
+ if(options.selector != "time"){
+ var datePattern = options.datePattern || bundle["dateFormat-"+formatLength];
+ if(datePattern){str.push(_processPattern(datePattern, sauce));}
+ }
+ if(options.selector != "date"){
+ var timePattern = options.timePattern || bundle["timeFormat-"+formatLength];
+ if(timePattern){str.push(_processPattern(timePattern, sauce));}
+ }
+ var result = str.join(" "); //TODO: use locale-specific pattern to assemble date + time
+
+ return result; // String
+};
+
+dojox.date.buddhist.locale.regexp = function(/*object?*/options){
+ // based on and similar to dojo.date.locale.regexp
+ // summary:
+ // Builds the regular needed to parse a buddhist.Date
+ return dojox.date.buddhist.locale._parseInfo(options).regexp; // String
+};
+
+dojox.date.buddhist.locale._parseInfo = function(/*oblect?*/options){
+/* based on and similar to dojo.date.locale._parseInfo */
+
+ options = options || {};
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+ var bundle = dojox.date.buddhist.locale._getBuddhistBundle(locale);
+ var formatLength = options.formatLength || 'short';
+ var datePattern = options.datePattern || bundle["dateFormat-" + formatLength];
+ var timePattern = options.timePattern || bundle["timeFormat-" + formatLength];
+
+ var pattern;
+ if(options.selector == 'date'){
+ pattern = datePattern;
+ }else if(options.selector == 'time'){
+ pattern = timePattern;
+ }else{
+ pattern = (typeof (timePattern) == "undefined") ? datePattern : datePattern + ' ' + timePattern;
+ }
+
+ var tokens = [];
+
+ var re = _processPattern(pattern, dojo.hitch(this, _buildDateTimeRE, tokens, bundle, options));
+ return {regexp: re, tokens: tokens, bundle: bundle};
+};
+
+
+
+
+dojox.date.buddhist.locale.parse= function(/*String*/value, /*object?*/options){
+ // based on and similar to dojo.date.locale.parse
+ // summary: This function parse string date value according to options
+ value = value.replace(/[\u200E\u200F\u202A-\u202E]/g, ""); //remove special chars
+
+ if(!options){options={};}
+ var info = dojox.date.buddhist.locale._parseInfo(options);
+
+ var tokens = info.tokens, bundle = info.bundle;
+ var re = new RegExp("^" + info.regexp + "$");
+
+ var match = re.exec(value);
+
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+
+ if(!match){
+ console.debug("dojox.date.buddhist.locale.parse: value "+value+" doesn't match pattern " + re);
+ return null;
+ } // null
+
+ var date, date1;
+
+ var result = [2513,0,1,0,0,0,0]; // buddhist date for [1970,0,1,0,0,0,0] used in gregorian locale
+ var amPm = "";
+ var mLength = 0;
+ var widthList = ["abbr", "wide", "narrow"];
+ var valid = dojo.every(match, function(v, i){
+ if(!i){return true;}
+ var token=tokens[i-1];
+ var l=token.length;
+ switch(token.charAt(0)){
+ case 'y':
+ result[0] = Number(v);
+ break;
+ case 'M':
+ if(l>2){
+ var months = bundle['months-format-' + widthList[l-3]].concat();
+ if(!options.strict){
+ //Tolerate abbreviating period in month part
+ //Case-insensitive comparison
+ v = v.replace(".","").toLowerCase();
+ months = dojo.map(months, function(s){ return s ? s.replace(".","").toLowerCase() : s; } );
+ }
+ v = dojo.indexOf(months, v);
+ if(v == -1){
+ return false;
+ }
+ mLength = l;
+ }else{
+ v--;
+ }
+ result[1] = Number(v);
+ break;
+ case 'D':
+ result[1] = 0;
+ // fallthrough...
+ case 'd':
+ result[2] = Number(v);
+ break;
+ case 'a': //am/pm
+ var am = options.am || bundle['dayPeriods-format-wide-am'],
+ pm = options.pm || bundle['dayPeriods-format-wide-pm'];
+ if(!options.strict){
+ var period = /\./g;
+ v = v.replace(period,'').toLowerCase();
+ am = am.replace(period,'').toLowerCase();
+ pm = pm.replace(period,'').toLowerCase();
+ }
+ if(options.strict && v != am && v != pm){
+ return false;
+ }
+
+ // we might not have seen the hours field yet, so store the state and apply hour change later
+ amPm = (v == pm) ? 'p' : (v == am) ? 'a' : '';
+ break;
+ case 'K': //hour (1-24)
+ if(v == 24){ v = 0; }
+ // fallthrough...
+ case 'h': //hour (1-12)
+ case 'H': //hour (0-23)
+ case 'k': //hour (0-11)
+ //in the 12-hour case, adjusting for am/pm requires the 'a' part
+ //which could come before or after the hour, so we will adjust later
+ result[3] = Number(v);
+ break;
+ case 'm': //minutes
+ result[4] = Number(v);
+ break;
+ case 's': //seconds
+ result[5] = Number(v);
+ break;
+ case 'S': //milliseconds
+ result[6] = Number(v);
+ }
+ return true;
+ });
+
+ var hours = +result[3];
+ if(amPm === 'p' && hours < 12){
+ result[3] = hours + 12; //e.g., 3pm -> 15
+ }else if(amPm === 'a' && hours == 12){
+ result[3] = 0; //12am -> 0
+ }
+ var dateObject = new dojox.date.buddhist.Date(result[0], result[1], result[2], result[3], result[4], result[5], result[6]);
+ return dateObject;
+};
+
+
+function _processPattern(pattern, applyPattern, applyLiteral, applyAll){
+ //summary: Process a pattern with literals in it
+
+ // Break up on single quotes, treat every other one as a literal, except '' which becomes '
+ var identity = function(x){return x;};
+ applyPattern = applyPattern || identity;
+ applyLiteral = applyLiteral || identity;
+ applyAll = applyAll || identity;
+
+ //split on single quotes (which escape literals in date format strings)
+ //but preserve escaped single quotes (e.g., o''clock)
+ var chunks = pattern.match(/(''|[^'])+/g);
+ var literal = pattern.charAt(0) == "'";
+
+ dojo.forEach(chunks, function(chunk, i){
+ if(!chunk){
+ chunks[i]='';
+ }else{
+ chunks[i]=(literal ? applyLiteral : applyPattern)(chunk);
+ literal = !literal;
+ }
+ });
+ return applyAll(chunks.join(''));
+}
+
+function _buildDateTimeRE (tokens, bundle, options, pattern){
+ // based on and similar to dojo.date.locale._buildDateTimeRE
+ //
+
+ pattern = dojo.regexp.escapeString(pattern);
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+
+ return pattern.replace(/([a-z])\1*/ig, function(match){
+
+ // Build a simple regexp. Avoid captures, which would ruin the tokens list
+ var s;
+ var c = match.charAt(0);
+ var l = match.length;
+ var p2 = '', p3 = '';
+ if(options.strict){
+ if(l > 1){ p2 = '0' + '{'+(l-1)+'}'; }
+ if(l > 2){ p3 = '0' + '{'+(l-2)+'}'; }
+ }else{
+ p2 = '0?'; p3 = '0{0,2}';
+ }
+ switch(c){
+ case 'y':
+ s = '\\d+';
+ break;
+ case 'M':
+ s = (l>2) ? '\\S+' : p2+'[1-9]|1[0-2]';
+ break;
+ case 'd':
+ s = '[12]\\d|'+p2+'[1-9]|3[01]';
+ break;
+ case 'E':
+ s = '\\S+';
+ break;
+ case 'h': //hour (1-12)
+ s = p2+'[1-9]|1[0-2]';
+ break;
+ case 'k': //hour (0-11)
+ s = p2+'\\d|1[01]';
+ break;
+ case 'H': //hour (0-23)
+ s = p2+'\\d|1\\d|2[0-3]';
+ break;
+ case 'K': //hour (1-24)
+ s = p2+'[1-9]|1\\d|2[0-4]';
+ break;
+ case 'm':
+ case 's':
+ s = p2+'\\d|[0-5]\\d';
+ break;
+ case 'S':
+ s = '\\d{'+l+'}';
+ break;
+ case 'a':
+ var am = options.am || bundle['dayPeriods-format-wide-am'],
+ pm = options.pm || bundle['dayPeriods-format-wide-pm'];
+ if(options.strict){
+ s = am + '|' + pm;
+ }else{
+ s = am + '|' + pm;
+ if(am != am.toLowerCase()){ s += '|' + am.toLowerCase(); }
+ if(pm != pm.toLowerCase()){ s += '|' + pm.toLowerCase(); }
+ }
+ break;
+ default:
+ s = ".*";
+ }
+ if(tokens){ tokens.push(match); }
+ return "(" + s + ")"; // add capture
+ }).replace(/[\xa0 ]/g, "[\\s\\xa0]"); // normalize whitespace. Need explicit handling of \xa0 for IE. */
+}
+})();
+
+
+
+(function(){
+var _customFormats = [];
+dojox.date.buddhist.locale.addCustomFormats = function(/*String*/packageName, /*String*/bundleName){
+ // summary:
+ // Add a reference to a bundle containing localized custom formats to be
+ // used by date/time formatting and parsing routines.
+ _customFormats.push({pkg:packageName,name:bundleName});
+};
+
+dojox.date.buddhist.locale._getBuddhistBundle = function(/*String*/locale){
+ var buddhist = {};
+ dojo.forEach(_customFormats, function(desc){
+ var bundle = dojo.i18n.getLocalization(desc.pkg, desc.name, locale);
+ buddhist = dojo.mixin(buddhist, bundle);
+ }, this);
+ return buddhist; /*Object*/
+};
+})();
+
+dojox.date.buddhist.locale.addCustomFormats("dojo.cldr","buddhist");
+
+dojox.date.buddhist.locale.getNames = function(/*String*/item, /*String*/type, /*String?*/context, /*String?*/locale, /*buddhist Date Object?*/date){
+ // summary:
+ // Used to get localized strings from dojo.cldr for day or month names.
+ var label;
+ var lookup = dojox.date.buddhist.locale._getBuddhistBundle(locale);
+ var props = [item, context, type];
+ if(context == 'standAlone'){
+ var key = props.join('-');
+ label = lookup[key];
+ // Fall back to 'format' flavor of name
+ if(label[0] == 1){ label = undefined; } // kludge, in the absence of real aliasing support in dojo.cldr
+ }
+ props[1] = 'format';
+
+ // return by copy so changes won't be made accidentally to the in-memory model
+ return (label || lookup[props.join('-')]).concat(); /*Array*/
+};
+
+}
diff --git a/js/dojo-1.6/dojox/date/buddhist/locale.xd.js b/js/dojo-1.6/dojox/date/buddhist/locale.xd.js
new file mode 100644
index 0000000..67d385f
--- /dev/null
+++ b/js/dojo-1.6/dojox/date/buddhist/locale.xd.js
@@ -0,0 +1,438 @@
+/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.date.buddhist.locale"],
+["require", "dojox.date.buddhist.Date"],
+["require", "dojo.regexp"],
+["require", "dojo.string"],
+["require", "dojo.i18n"],
+["requireLocalization", "dojo.cldr", "buddhist", null, "ROOT,ar,da,de,el,en,en-gb,es,fi,ro,th,zh-hant", "ROOT,ar,da,de,el,en,en-gb,es,fi,ro,th,zh-hant"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.date.buddhist.locale"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.date.buddhist.locale"] = true;
+dojo.provide("dojox.date.buddhist.locale");
+dojo.experimental("dojox.date.buddhist.locale");
+
+dojo.require("dojox.date.buddhist.Date");
+dojo.require("dojo.regexp");
+dojo.require("dojo.string");
+dojo.require("dojo.i18n");
+
+;
+
+(function(){
+ // Format a pattern without literals
+ function formatPattern(dateObject, bundle, locale, fullYear, pattern){
+
+ return pattern.replace(/([a-z])\1*/ig, function(match){
+ var s, pad;
+ var c = match.charAt(0);
+ var l = match.length;
+ var widthList = ["abbr", "wide", "narrow"];
+
+ switch(c){
+ case 'G':
+ s = bundle["eraAbbr"][0];
+ break;
+ case 'y':
+ s = String(dateObject.getFullYear());
+ break;
+ case 'M':
+ var m = dateObject.getMonth();
+ if(l<3){
+ s = m+1; pad = true;
+ }else{
+ var propM = ["months", "format", widthList[l-3]].join("-");
+ s = bundle[propM][m];
+ }
+ break;
+ case 'd':
+ s = dateObject.getDate(true); pad = true;
+ break;
+ case 'E':
+ var d = dateObject.getDay();
+ if(l<3){
+ s = d+1; pad = true;
+ }else{
+ var propD = ["days", "format", widthList[l-3]].join("-");
+ s = bundle[propD][d];
+ }
+ break;
+ case 'a':
+ var timePeriod = (dateObject.getHours() < 12) ? 'am' : 'pm';
+ s = bundle['dayPeriods-format-wide-' + timePeriod];
+ break;
+ case 'h':
+ case 'H':
+ case 'K':
+ case 'k':
+ var h = dateObject.getHours();
+ switch (c){
+ case 'h': // 1-12
+ s = (h % 12) || 12;
+ break;
+ case 'H': // 0-23
+ s = h;
+ break;
+ case 'K': // 0-11
+ s = (h % 12);
+ break;
+ case 'k': // 1-24
+ s = h || 24;
+ break;
+ }
+ pad = true;
+ break;
+ case 'm':
+ s = dateObject.getMinutes(); pad = true;
+ break;
+ case 's':
+ s = dateObject.getSeconds(); pad = true;
+ break;
+ case 'S':
+ s = Math.round(dateObject.getMilliseconds() * Math.pow(10, l-3)); pad = true;
+ break;
+ case 'z':
+ // We only have one timezone to offer; the one from the browser
+ s = dojo.date.getTimezoneName(dateObject.toGregorian());
+ if(s){ break; }
+ l = 4;
+ // fallthrough... use GMT if tz not available
+ case 'Z':
+ var offset = dateObject.toGregorian().getTimezoneOffset();
+ var tz = [
+ (offset <= 0 ? "+" : "-"),
+ dojo.string.pad(Math.floor(Math.abs(offset) / 60), 2),
+ dojo.string.pad(Math.abs(offset) % 60, 2)
+ ];
+ if(l == 4){
+ tz.splice(0, 0, "GMT");
+ tz.splice(3, 0, ":");
+ }
+ s = tz.join("");
+ break;
+ default:
+ throw new Error("dojox.date.buddhist.locale.formatPattern: invalid pattern char: "+pattern);
+ }
+ if(pad){ s = dojo.string.pad(s, l); }
+ return s;
+ });
+ }
+
+dojox.date.buddhist.locale.format = function(/*buddhist.Date*/dateObject, /*object?*/options){
+ // based on and similar to dojo.date.locale.format
+ //summary:
+ // Format a Date object as a String, using settings.
+ options = options || {};
+
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+ var formatLength = options.formatLength || 'short';
+ var bundle = dojox.date.buddhist.locale._getBuddhistBundle(locale);
+ var str = [];
+
+ var sauce = dojo.hitch(this, formatPattern, dateObject, bundle, locale, options.fullYear);
+ if(options.selector == "year"){
+ var year = dateObject.getFullYear();
+ return year;
+ }
+ if(options.selector != "time"){
+ var datePattern = options.datePattern || bundle["dateFormat-"+formatLength];
+ if(datePattern){str.push(_processPattern(datePattern, sauce));}
+ }
+ if(options.selector != "date"){
+ var timePattern = options.timePattern || bundle["timeFormat-"+formatLength];
+ if(timePattern){str.push(_processPattern(timePattern, sauce));}
+ }
+ var result = str.join(" "); //TODO: use locale-specific pattern to assemble date + time
+
+ return result; // String
+};
+
+dojox.date.buddhist.locale.regexp = function(/*object?*/options){
+ // based on and similar to dojo.date.locale.regexp
+ // summary:
+ // Builds the regular needed to parse a buddhist.Date
+ return dojox.date.buddhist.locale._parseInfo(options).regexp; // String
+};
+
+dojox.date.buddhist.locale._parseInfo = function(/*oblect?*/options){
+/* based on and similar to dojo.date.locale._parseInfo */
+
+ options = options || {};
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+ var bundle = dojox.date.buddhist.locale._getBuddhistBundle(locale);
+ var formatLength = options.formatLength || 'short';
+ var datePattern = options.datePattern || bundle["dateFormat-" + formatLength];
+ var timePattern = options.timePattern || bundle["timeFormat-" + formatLength];
+
+ var pattern;
+ if(options.selector == 'date'){
+ pattern = datePattern;
+ }else if(options.selector == 'time'){
+ pattern = timePattern;
+ }else{
+ pattern = (typeof (timePattern) == "undefined") ? datePattern : datePattern + ' ' + timePattern;
+ }
+
+ var tokens = [];
+
+ var re = _processPattern(pattern, dojo.hitch(this, _buildDateTimeRE, tokens, bundle, options));
+ return {regexp: re, tokens: tokens, bundle: bundle};
+};
+
+
+
+
+dojox.date.buddhist.locale.parse= function(/*String*/value, /*object?*/options){
+ // based on and similar to dojo.date.locale.parse
+ // summary: This function parse string date value according to options
+ value = value.replace(/[\u200E\u200F\u202A-\u202E]/g, ""); //remove special chars
+
+ if(!options){options={};}
+ var info = dojox.date.buddhist.locale._parseInfo(options);
+
+ var tokens = info.tokens, bundle = info.bundle;
+ var re = new RegExp("^" + info.regexp + "$");
+
+ var match = re.exec(value);
+
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+
+ if(!match){
+ console.debug("dojox.date.buddhist.locale.parse: value "+value+" doesn't match pattern " + re);
+ return null;
+ } // null
+
+ var date, date1;
+
+ var result = [2513,0,1,0,0,0,0]; // buddhist date for [1970,0,1,0,0,0,0] used in gregorian locale
+ var amPm = "";
+ var mLength = 0;
+ var widthList = ["abbr", "wide", "narrow"];
+ var valid = dojo.every(match, function(v, i){
+ if(!i){return true;}
+ var token=tokens[i-1];
+ var l=token.length;
+ switch(token.charAt(0)){
+ case 'y':
+ result[0] = Number(v);
+ break;
+ case 'M':
+ if(l>2){
+ var months = bundle['months-format-' + widthList[l-3]].concat();
+ if(!options.strict){
+ //Tolerate abbreviating period in month part
+ //Case-insensitive comparison
+ v = v.replace(".","").toLowerCase();
+ months = dojo.map(months, function(s){ return s ? s.replace(".","").toLowerCase() : s; } );
+ }
+ v = dojo.indexOf(months, v);
+ if(v == -1){
+ return false;
+ }
+ mLength = l;
+ }else{
+ v--;
+ }
+ result[1] = Number(v);
+ break;
+ case 'D':
+ result[1] = 0;
+ // fallthrough...
+ case 'd':
+ result[2] = Number(v);
+ break;
+ case 'a': //am/pm
+ var am = options.am || bundle['dayPeriods-format-wide-am'],
+ pm = options.pm || bundle['dayPeriods-format-wide-pm'];
+ if(!options.strict){
+ var period = /\./g;
+ v = v.replace(period,'').toLowerCase();
+ am = am.replace(period,'').toLowerCase();
+ pm = pm.replace(period,'').toLowerCase();
+ }
+ if(options.strict && v != am && v != pm){
+ return false;
+ }
+
+ // we might not have seen the hours field yet, so store the state and apply hour change later
+ amPm = (v == pm) ? 'p' : (v == am) ? 'a' : '';
+ break;
+ case 'K': //hour (1-24)
+ if(v == 24){ v = 0; }
+ // fallthrough...
+ case 'h': //hour (1-12)
+ case 'H': //hour (0-23)
+ case 'k': //hour (0-11)
+ //in the 12-hour case, adjusting for am/pm requires the 'a' part
+ //which could come before or after the hour, so we will adjust later
+ result[3] = Number(v);
+ break;
+ case 'm': //minutes
+ result[4] = Number(v);
+ break;
+ case 's': //seconds
+ result[5] = Number(v);
+ break;
+ case 'S': //milliseconds
+ result[6] = Number(v);
+ }
+ return true;
+ });
+
+ var hours = +result[3];
+ if(amPm === 'p' && hours < 12){
+ result[3] = hours + 12; //e.g., 3pm -> 15
+ }else if(amPm === 'a' && hours == 12){
+ result[3] = 0; //12am -> 0
+ }
+ var dateObject = new dojox.date.buddhist.Date(result[0], result[1], result[2], result[3], result[4], result[5], result[6]);
+ return dateObject;
+};
+
+
+function _processPattern(pattern, applyPattern, applyLiteral, applyAll){
+ //summary: Process a pattern with literals in it
+
+ // Break up on single quotes, treat every other one as a literal, except '' which becomes '
+ var identity = function(x){return x;};
+ applyPattern = applyPattern || identity;
+ applyLiteral = applyLiteral || identity;
+ applyAll = applyAll || identity;
+
+ //split on single quotes (which escape literals in date format strings)
+ //but preserve escaped single quotes (e.g., o''clock)
+ var chunks = pattern.match(/(''|[^'])+/g);
+ var literal = pattern.charAt(0) == "'";
+
+ dojo.forEach(chunks, function(chunk, i){
+ if(!chunk){
+ chunks[i]='';
+ }else{
+ chunks[i]=(literal ? applyLiteral : applyPattern)(chunk);
+ literal = !literal;
+ }
+ });
+ return applyAll(chunks.join(''));
+}
+
+function _buildDateTimeRE (tokens, bundle, options, pattern){
+ // based on and similar to dojo.date.locale._buildDateTimeRE
+ //
+
+ pattern = dojo.regexp.escapeString(pattern);
+ var locale = dojo.i18n.normalizeLocale(options.locale);
+
+ return pattern.replace(/([a-z])\1*/ig, function(match){
+
+ // Build a simple regexp. Avoid captures, which would ruin the tokens list
+ var s;
+ var c = match.charAt(0);
+ var l = match.length;
+ var p2 = '', p3 = '';
+ if(options.strict){
+ if(l > 1){ p2 = '0' + '{'+(l-1)+'}'; }
+ if(l > 2){ p3 = '0' + '{'+(l-2)+'}'; }
+ }else{
+ p2 = '0?'; p3 = '0{0,2}';
+ }
+ switch(c){
+ case 'y':
+ s = '\\d+';
+ break;
+ case 'M':
+ s = (l>2) ? '\\S+' : p2+'[1-9]|1[0-2]';
+ break;
+ case 'd':
+ s = '[12]\\d|'+p2+'[1-9]|3[01]';
+ break;
+ case 'E':
+ s = '\\S+';
+ break;
+ case 'h': //hour (1-12)
+ s = p2+'[1-9]|1[0-2]';
+ break;
+ case 'k': //hour (0-11)
+ s = p2+'\\d|1[01]';
+ break;
+ case 'H': //hour (0-23)
+ s = p2+'\\d|1\\d|2[0-3]';
+ break;
+ case 'K': //hour (1-24)
+ s = p2+'[1-9]|1\\d|2[0-4]';
+ break;
+ case 'm':
+ case 's':
+ s = p2+'\\d|[0-5]\\d';
+ break;
+ case 'S':
+ s = '\\d{'+l+'}';
+ break;
+ case 'a':
+ var am = options.am || bundle['dayPeriods-format-wide-am'],
+ pm = options.pm || bundle['dayPeriods-format-wide-pm'];
+ if(options.strict){
+ s = am + '|' + pm;
+ }else{
+ s = am + '|' + pm;
+ if(am != am.toLowerCase()){ s += '|' + am.toLowerCase(); }
+ if(pm != pm.toLowerCase()){ s += '|' + pm.toLowerCase(); }
+ }
+ break;
+ default:
+ s = ".*";
+ }
+ if(tokens){ tokens.push(match); }
+ return "(" + s + ")"; // add capture
+ }).replace(/[\xa0 ]/g, "[\\s\\xa0]"); // normalize whitespace. Need explicit handling of \xa0 for IE. */
+}
+})();
+
+
+
+(function(){
+var _customFormats = [];
+dojox.date.buddhist.locale.addCustomFormats = function(/*String*/packageName, /*String*/bundleName){
+ // summary:
+ // Add a reference to a bundle containing localized custom formats to be
+ // used by date/time formatting and parsing routines.
+ _customFormats.push({pkg:packageName,name:bundleName});
+};
+
+dojox.date.buddhist.locale._getBuddhistBundle = function(/*String*/locale){
+ var buddhist = {};
+ dojo.forEach(_customFormats, function(desc){
+ var bundle = dojo.i18n.getLocalization(desc.pkg, desc.name, locale);
+ buddhist = dojo.mixin(buddhist, bundle);
+ }, this);
+ return buddhist; /*Object*/
+};
+})();
+
+dojox.date.buddhist.locale.addCustomFormats("dojo.cldr","buddhist");
+
+dojox.date.buddhist.locale.getNames = function(/*String*/item, /*String*/type, /*String?*/context, /*String?*/locale, /*buddhist Date Object?*/date){
+ // summary:
+ // Used to get localized strings from dojo.cldr for day or month names.
+ var label;
+ var lookup = dojox.date.buddhist.locale._getBuddhistBundle(locale);
+ var props = [item, context, type];
+ if(context == 'standAlone'){
+ var key = props.join('-');
+ label = lookup[key];
+ // Fall back to 'format' flavor of name
+ if(label[0] == 1){ label = undefined; } // kludge, in the absence of real aliasing support in dojo.cldr
+ }
+ props[1] = 'format';
+
+ // return by copy so changes won't be made accidentally to the in-memory model
+ return (label || lookup[props.join('-')]).concat(); /*Array*/
+};
+
+}
+
+}};});