summaryrefslogtreecommitdiffstatshomepage
path: root/includes/js/dojox/date
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dojox/date')
-rw-r--r--includes/js/dojox/date/README36
-rw-r--r--includes/js/dojox/date/php.js312
-rw-r--r--includes/js/dojox/date/posix.js293
-rw-r--r--includes/js/dojox/date/tests/module.js12
-rw-r--r--includes/js/dojox/date/tests/posix.js236
-rw-r--r--includes/js/dojox/date/tests/runTests.html9
6 files changed, 0 insertions, 898 deletions
diff --git a/includes/js/dojox/date/README b/includes/js/dojox/date/README
deleted file mode 100644
index 8ad5aba..0000000
--- a/includes/js/dojox/date/README
+++ /dev/null
@@ -1,36 +0,0 @@
--------------------------------------------------------------------------------
-DojoX Date
--------------------------------------------------------------------------------
-Version 0.9
-Release date: 5/17/2007
--------------------------------------------------------------------------------
-Project state:
-experimental
--------------------------------------------------------------------------------
-Credits
- Paul Sowden, Adam Peller (dojox.date.posix)
- Neil Roberts (dojox.date.php)
--------------------------------------------------------------------------------
-Project description
-
-Placeholder for any kind of date operations, including formatters that are
-common to other languages (posix and php).
--------------------------------------------------------------------------------
-Dependencies:
-
-Depends only on the Dojo Core.
--------------------------------------------------------------------------------
-Documentation
-
-See the API documentation for details.
--------------------------------------------------------------------------------
-Installation instructions
-
-Grab the following from the Dojo SVN Repository:
-http://svn.dojotoolkit.org/var/src/dojo/dojox/trunk/date/*
-
-Install into the following directory structure:
-/dojox/date/
-
-...which should be at the same level as your Dojo checkout.
--------------------------------------------------------------------------------
diff --git a/includes/js/dojox/date/php.js b/includes/js/dojox/date/php.js
deleted file mode 100644
index 3cee1a2..0000000
--- a/includes/js/dojox/date/php.js
+++ /dev/null
@@ -1,312 +0,0 @@
-if(!dojo._hasResource["dojox.date.php"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.date.php"] = true;
-dojo.provide("dojox.date.php");
-dojo.require("dojo.date");
-dojo.require("dojox.string.tokenize");
-
-dojox.date.php.format = function(/*Date*/ date, /*String*/ format){
- // summary: Get a formatted string for a given date object
- var df = new dojox.date.php.DateFormat(format);
- return df.format(date);
-}
-
-dojox.date.php.DateFormat = function(/*String*/ format){
- // summary: Format the internal date object
- if(!this.regex){
- var keys = [];
- for(var key in this.constructor.prototype){
- if(dojo.isString(key) && key.length == 1 && dojo.isFunction(this[key])){
- keys.push(key);
- }
- }
- this.constructor.prototype.regex = new RegExp("(?:(\\\\.)|([" + keys.join("") + "]))", "g");
- }
-
- var replacements = [];
-
- this.tokens = dojox.string.tokenize(format, this.regex, function(escape, token, i){
- if(token){
- replacements.push([i, token]);
- return token;
- }
- if(escape){
- return escape.charAt(1);
- }
- });
-
- this.replacements = replacements;
-}
-dojo.extend(dojox.date.php.DateFormat, {
- weekdays: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
- weekdays_3: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
- months_3: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
- monthdays: [31,28,31,30,31,30,31,31,30,31,30,31],
-
- format: function(/*Date*/ date){
- this.date = date;
- for(var i = 0, replacement; replacement = this.replacements[i]; i++){
- this.tokens[replacement[0]] = this[replacement[1]]();
- }
- return this.tokens.join("");
- },
-
- // Day
-
- d: function(){
- // summary: Day of the month, 2 digits with leading zeros
- var j = this.j();
- return (j.length == 1) ? "0" + j : j;
- },
-
- D: function(){
- // summary: A textual representation of a day, three letters
- return this.weekdays_3[this.date.getDay()];
- },
-
- j: function(){
- // summary: Day of the month without leading zeros
- return this.date.getDate() + "";
- },
-
- l: function(){
- // summary: A full textual representation of the day of the week
- return this.weekdays[this.date.getDay()];
- },
-
- N: function(){
- // summary: ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)
- var w = this.w();
- return (!w) ? 7 : w;
- },
-
- S: function(){
- // summary: English ordinal suffix for the day of the month, 2 characters
- switch(this.date.getDate()){
- case 11: case 12: case 13: return "th";
- case 1: case 21: case 31: return "st";
- case 2: case 22: return "nd";
- case 3: case 23: return "rd";
- default: return "th";
- }
- },
-
- w: function(){
- // summary: Numeric representation of the day of the week
- return this.date.getDay() + "";
- },
-
- z: function(){
- // summary: The day of the year (starting from 0)
- var millis = this.date.getTime() - new Date(this.date.getFullYear(), 0, 1).getTime();
- return Math.floor(millis/86400000) + "";
- },
-
- // Week
-
- W: function(){
- // summary: ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)
- var week;
- var jan1_w = new Date(this.date.getFullYear(), 0, 1).getDay() + 1;
- var w = this.date.getDay() + 1;
- var z = parseInt(this.z());
-
- if(z <= (8 - jan1_w) && jan1_w > 4){
- var last_year = new Date(this.date.getFullYear() - 1, this.date.getMonth(), this.date.getDate());
- if(jan1_w == 5 || (jan1_w == 6 && dojo.date.isLeapYear(last_year))){
- week = 53;
- }else{
- week = 52;
- }
- }else{
- var i;
- if(Boolean(this.L())){
- i = 366;
- }else{
- i = 365;
- }
- if((i - z) < (4 - w)){
- week = 1;
- }else{
- var j = z + (7 - w) + (jan1_w - 1);
- week = Math.ceil(j / 7);
- if(jan1_w > 4){
- --week;
- }
- }
- }
-
- return week;
- },
-
- // Month
-
- F: function(){
- // summary: A full textual representation of a month, such as January or March
- return this.months[this.date.getMonth()];
- },
-
- m: function(){
- // summary: Numeric representation of a month, with leading zeros
- var n = this.n();
- return (n.length == 1) ? "0" + n : n;
- },
-
- M: function(){
- // summary: A short textual representation of a month, three letters
- return this.months_3[this.date.getMonth()];
- },
-
- n: function(){
- // summary: Numeric representation of a month, without leading zeros
- return this.date.getMonth() + 1 + "";
- },
-
- t: function(){
- // summary: Number of days in the given month
- return (Boolean(this.L()) && this.date.getMonth() == 1) ? 29 : this.monthdays[this.getMonth()];
- },
-
- // Year
-
- L: function(){
- // summary: Whether it's a leap year
- return (dojo.date.isLeapYear(this.date)) ? "1" : "0";
- },
-
- o: function(){
- // summary:
- // ISO-8601 year number. This has the same value as Y, except that if
- // the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)
- // TODO: Figure out what this means
- },
-
- Y: function(){
- // summary: A full numeric representation of a year, 4 digits
- return this.date.getFullYear() + "";
- },
-
- y: function(){
- // summary: A two digit representation of a year
- return this.Y().slice(-2);
- },
-
- // Time
-
- a: function(){
- // summary: Lowercase Ante meridiem and Post meridiem
- return this.date.getHours() >= 12 ? "pm" : "am";
- },
-
- b: function(){
- // summary: Uppercase Ante meridiem and Post meridiem
- return this.a().toUpperCase();
- },
-
- B: function(){
- // summary:
- // Swatch Internet time
- // A day is 1,000 beats. All time is measured from GMT + 1
- var off = this.date.getTimezoneOffset() + 60;
- var secs = (this.date.getHours() * 3600) + (this.date.getMinutes() * 60) + this.getSeconds() + (off * 60);
- var beat = Math.abs(Math.floor(secs / 86.4) % 1000) + "";
- while(beat.length < 2) beat = "0" + beat;
- return beat;
- },
-
- g: function(){
- // summary: 12-hour format of an hour without leading zeros
- return (this.date.getHours() > 12) ? this.date.getHours() - 12 + "" : this.date.getHours() + "";
- },
-
- G: function(){
- // summary: 24-hour format of an hour without leading zeros
- return this.date.getHours() + "";
- },
-
- h: function(){
- // summary: 12-hour format of an hour with leading zeros
- var g = this.g();
- return (g.length == 1) ? "0" + g : g;
- },
-
- H: function(){
- // summary: 24-hour format of an hour with leading zeros
- var G = this.G();
- return (G.length == 1) ? "0" + G : G;
- },
-
- i: function(){
- // summary: Minutes with leading zeros
- var mins = this.date.getMinutes() + "";
- return (mins.length == 1) ? "0" + mins : mins;
- },
-
- s: function(){
- // summary: Seconds, with leading zeros
- var secs = this.date.getSeconds() + "";
- return (secs.length == 1) ? "0" + secs : secs;
- },
-
- // Timezone
-
- e: function(){
- // summary: Timezone identifier (added in PHP 5.1.0)
- return dojo.date.getTimezoneName(this.date);
- },
-
- I: function(){
- // summary: Whether or not the date is in daylight saving time
- // TODO: Can dojo.date do this?
- },
-
- O: function(){
- // summary: Difference to Greenwich time (GMT) in hours
- var off = Math.abs(this.date.getTimezoneOffset());
- var hours = Math.floor(off / 60) + "";
- var mins = (off % 60) + "";
- if(hours.length == 1) hours = "0" + hours;
- if(mins.length == 1) hours = "0" + mins;
- return ((this.date.getTimezoneOffset() < 0) ? "+" : "-") + hours + mins;
- },
-
- P: function(){
- // summary: Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)
- var O = this.O();
- return O.substring(0, 2) + ":" + O.substring(2, 4);
- },
-
- T: function(){
- // summary: Timezone abbreviation
-
- // Guess...
- return this.e().substring(0, 3);
- },
-
- Z: function(){
- // summary:
- // Timezone offset in seconds. The offset for timezones west of UTC is always negative,
- // and for those east of UTC is always positive.
- return this.date.getTimezoneOffset() * -60;
- },
-
- // Full Date/Time
-
- c: function(){
- // summary: ISO 8601 date (added in PHP 5)
- return this.Y() + "-" + this.m() + "-" + this.d() + "T" + this.h() + ":" + this.i() + ":" + this.s() + this.P();
- },
-
- r: function(){
- // summary: RFC 2822 formatted date
- return this.D() + ", " + this.d() + " " + this.M() + " " + this.Y() + " " + this.H() + ":" + this.i() + ":" + this.s() + " " + this.O();
- },
-
- U: function(){
- // summary: Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
- return Math.floor(this.date.getTime() / 1000);
- }
-
-});
-
-}
diff --git a/includes/js/dojox/date/posix.js b/includes/js/dojox/date/posix.js
deleted file mode 100644
index 88e9c47..0000000
--- a/includes/js/dojox/date/posix.js
+++ /dev/null
@@ -1,293 +0,0 @@
-if(!dojo._hasResource["dojox.date.posix"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.date.posix"] = true;
-dojo.provide("dojox.date.posix");
-
-dojo.require("dojo.date");
-dojo.require("dojo.date.locale");
-dojo.require("dojo.string");
-
-dojox.date.posix.strftime = function(/*Date*/dateObject, /*String*/format, /*String?*/locale){
-//
-// summary:
-// Formats the date object using the specifications of the POSIX strftime function
-//
-// description:
-// see http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html
-
- // zero pad
- var padChar = null;
- var _ = function(s, n){
- return dojo.string.pad(s, n || 2, padChar || "0");
- };
-
- var bundle = dojo.date.locale._getGregorianBundle(locale);
-
- var $ = function(property){
- switch(property){
- case "a": // abbreviated weekday name according to the current locale
- return dojo.date.locale.getNames('days', 'abbr', 'format', locale)[dateObject.getDay()];
-
- case "A": // full weekday name according to the current locale
- return dojo.date.locale.getNames('days', 'wide', 'format', locale)[dateObject.getDay()];
-
- case "b":
- case "h": // abbreviated month name according to the current locale
- return dojo.date.locale.getNames('months', 'abbr', 'format', locale)[dateObject.getMonth()];
-
- case "B": // full month name according to the current locale
- return dojo.date.locale.getNames('months', 'wide', 'format', locale)[dateObject.getMonth()];
-
- case "c": // preferred date and time representation for the current
- // locale
- return dojo.date.locale.format(dateObject, {formatLength: 'full', locale: locale});
-
- case "C": // century number (the year divided by 100 and truncated
- // to an integer, range 00 to 99)
- return _(Math.floor(dateObject.getFullYear()/100));
-
- case "d": // day of the month as a decimal number (range 01 to 31)
- return _(dateObject.getDate());
-
- case "D": // same as %m/%d/%y
- return $("m") + "/" + $("d") + "/" + $("y");
-
- case "e": // day of the month as a decimal number, a single digit is
- // preceded by a space (range ' 1' to '31')
- if(padChar == null){ padChar = " "; }
- return _(dateObject.getDate());
-
- case "f": // month as a decimal number, a single digit is
- // preceded by a space (range ' 1' to '12')
- if(padChar == null){ padChar = " "; }
- return _(dateObject.getMonth()+1);
-
- case "g": // like %G, but without the century.
- break;
-
- case "G": // The 4-digit year corresponding to the ISO week number
- // (see %V). This has the same format and value as %Y,
- // except that if the ISO week number belongs to the
- // previous or next year, that year is used instead.
- dojo.unimplemented("unimplemented modifier 'G'");
- break;
-
- case "F": // same as %Y-%m-%d
- return $("Y") + "-" + $("m") + "-" + $("d");
-
- case "H": // hour as a decimal number using a 24-hour clock (range
- // 00 to 23)
- return _(dateObject.getHours());
-
- case "I": // hour as a decimal number using a 12-hour clock (range
- // 01 to 12)
- return _(dateObject.getHours() % 12 || 12);
-
- case "j": // day of the year as a decimal number (range 001 to 366)
- return _(dojo.date.locale._getDayOfYear(dateObject), 3);
-
- case "k": // Hour as a decimal number using a 24-hour clock (range
- // 0 to 23 (space-padded))
- if(padChar == null){ padChar = " "; }
- return _(dateObject.getHours());
-
- case "l": // Hour as a decimal number using a 12-hour clock (range
- // 1 to 12 (space-padded))
- if(padChar == null){ padChar = " "; }
- return _(dateObject.getHours() % 12 || 12);
-
- case "m": // month as a decimal number (range 01 to 12)
- return _(dateObject.getMonth() + 1);
-
- case "M": // minute as a decimal number
- return _(dateObject.getMinutes());
-
- case "n":
- return "\n";
-
- case "p": // either `am' or `pm' according to the given time value,
- // or the corresponding strings for the current locale
- return bundle[dateObject.getHours() < 12 ? "am" : "pm"];
-
- case "r": // time in a.m. and p.m. notation
- return $("I") + ":" + $("M") + ":" + $("S") + " " + $("p");
-
- case "R": // time in 24 hour notation
- return $("H") + ":" + $("M");
-
- case "S": // second as a decimal number
- return _(dateObject.getSeconds());
-
- case "t":
- return "\t";
-
- case "T": // current time, equal to %H:%M:%S
- return $("H") + ":" + $("M") + ":" + $("S");
-
- case "u": // weekday as a decimal number [1,7], with 1 representing
- // Monday
- return String(dateObject.getDay() || 7);
-
- case "U": // week number of the current year as a decimal number,
- // starting with the first Sunday as the first day of the
- // first week
- return _(dojo.date.locale._getWeekOfYear(dateObject));
-
- case "V": // week number of the year (Monday as the first day of the
- // week) as a decimal number [01,53]. If the week containing
- // 1 January has four or more days in the new year, then it
- // is considered week 1. Otherwise, it is the last week of
- // the previous year, and the next week is week 1.
- return _(dojox.date.posix.getIsoWeekOfYear(dateObject));
-
- case "W": // week number of the current year as a decimal number,
- // starting with the first Monday as the first day of the
- // first week
- return _(dojo.date.locale._getWeekOfYear(dateObject, 1));
-
- case "w": // day of the week as a decimal, Sunday being 0
- return String(dateObject.getDay());
-
- case "x": // preferred date representation for the current locale
- // without the time
- return dojo.date.locale.format(dateObject, {selector:'date', formatLength: 'full', locale:locale});
-
- case "X": // preferred time representation for the current locale
- // without the date
- return dojo.date.locale.format(dateObject, {selector:'time', formatLength: 'full', locale:locale});
-
- case "y": // year as a decimal number without a century (range 00 to
- // 99)
- return _(dateObject.getFullYear()%100);
-
- case "Y": // year as a decimal number including the century
- return String(dateObject.getFullYear());
-
- case "z": // time zone or name or abbreviation
- var timezoneOffset = dateObject.getTimezoneOffset();
- return (timezoneOffset > 0 ? "-" : "+") +
- _(Math.floor(Math.abs(timezoneOffset)/60)) + ":" +
- _(Math.abs(timezoneOffset)%60);
-
- case "Z": // time zone or name or abbreviation
- return dojo.date.getTimezoneName(dateObject);
-
- case "%":
- return "%";
- }
- };
-
- // parse the formatting string and construct the resulting string
- var string = "";
- var i = 0;
- var index = 0;
- var switchCase = null;
- while ((index = format.indexOf("%", i)) != -1){
- string += format.substring(i, index++);
-
- // inspect modifier flag
- switch (format.charAt(index++)) {
- case "_": // Pad a numeric result string with spaces.
- padChar = " "; break;
- case "-": // Do not pad a numeric result string.
- padChar = ""; break;
- case "0": // Pad a numeric result string with zeros.
- padChar = "0"; break;
- case "^": // Convert characters in result string to uppercase.
- switchCase = "upper"; break;
- case "*": // Convert characters in result string to lowercase
- switchCase = "lower"; break;
- case "#": // Swap the case of the result string.
- switchCase = "swap"; break;
- default: // no modifier flag so decrement the index
- padChar = null; index--; break;
- }
-
- // toggle case if a flag is set
- var property = $(format.charAt(index++));
- switch (switchCase){
- case "upper":
- property = property.toUpperCase();
- break;
- case "lower":
- property = property.toLowerCase();
- break;
- case "swap": // Upper to lower, and versey-vicea
- var compareString = property.toLowerCase();
- var swapString = '';
- var ch = '';
- for (var j = 0; j < property.length; j++){
- ch = property.charAt(j);
- swapString += (ch == compareString.charAt(j)) ?
- ch.toUpperCase() : ch.toLowerCase();
- }
- property = swapString;
- break;
- default:
- break;
- }
- switchCase = null;
-
- string += property;
- i = index;
- }
- string += format.substring(i);
-
- return string; // String
-};
-
-dojox.date.posix.getStartOfWeek = function(/*Date*/dateObject, /*Number*/firstDay){
- // summary: Return a date object representing the first day of the given
- // date's week.
- if(isNaN(firstDay)){
- firstDay = dojo.cldr.supplemental.getFirstDayOfWeek ? dojo.cldr.supplemental.getFirstDayOfWeek() : 0;
- }
- var offset = firstDay;
- if(dateObject.getDay() >= firstDay){
- offset -= dateObject.getDay();
- }else{
- offset -= (7 - dateObject.getDay());
- }
- var date = new Date(dateObject);
- date.setHours(0, 0, 0, 0);
- return dojo.date.add(date, "day", offset); // Date
-}
-
-dojox.date.posix.setIsoWeekOfYear = function(/*Date*/dateObject, /*Number*/week){
- // summary: Set the ISO8601 week number of the given date.
- // The week containing January 4th is the first week of the year.
- // week:
- // can be positive or negative: -1 is the year's last week.
- if(!week){ return dateObject; }
- var currentWeek = dojox.date.posix.getIsoWeekOfYear(dateObject);
- var offset = week - currentWeek;
- if(week < 0){
- var weeks = dojox.date.posix.getIsoWeeksInYear(dateObject);
- offset = (weeks + week + 1) - currentWeek;
- }
- return dojo.date.add(dateObject, "week", offset); // Date
-}
-
-dojox.date.posix.getIsoWeekOfYear = function(/*Date*/dateObject){
- // summary: Get the ISO8601 week number of the given date.
- // The week containing January 4th is the first week of the year.
- // See http://en.wikipedia.org/wiki/ISO_week_date
- var weekStart = dojox.date.posix.getStartOfWeek(dateObject, 1);
- var yearStart = new Date(dateObject.getFullYear(), 0, 4); // January 4th
- yearStart = dojox.date.posix.getStartOfWeek(yearStart, 1);
- var diff = weekStart.getTime() - yearStart.getTime();
- if(diff < 0){ return dojox.date.posix.getIsoWeeksInYear(weekStart); } // Integer
- return Math.ceil(diff / 604800000) + 1; // Integer
-}
-
-dojox.date.posix.getIsoWeeksInYear = function(/*Date*/dateObject) {
- // summary: Determine the number of ISO8601 weeks in the year of the given
- // date. Most years have 52 but some have 53.
- // See http://www.phys.uu.nl/~vgent/calendar/isocalendar_text3.htm
- function p(y) {
- return y + Math.floor(y/4) - Math.floor(y/100) + Math.floor(y/400);
- }
- var y = dateObject.getFullYear();
- return ( p(y) % 7 == 4 || p(y-1) % 7 == 3 ) ? 53 : 52; // Integer
-}
-
-}
diff --git a/includes/js/dojox/date/tests/module.js b/includes/js/dojox/date/tests/module.js
deleted file mode 100644
index 9e1a297..0000000
--- a/includes/js/dojox/date/tests/module.js
+++ /dev/null
@@ -1,12 +0,0 @@
-if(!dojo._hasResource["dojox.date.tests.module"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.date.tests.module"] = true;
-dojo.provide("dojox.date.tests.module");
-
-try{
- dojo.require("dojox.date.tests.posix");
-}catch(e){
- doh.debug(e);
-}
-
-
-}
diff --git a/includes/js/dojox/date/tests/posix.js b/includes/js/dojox/date/tests/posix.js
deleted file mode 100644
index 84039f9..0000000
--- a/includes/js/dojox/date/tests/posix.js
+++ /dev/null
@@ -1,236 +0,0 @@
-if(!dojo._hasResource["dojox.date.tests.posix"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.date.tests.posix"] = true;
-dojo.provide("dojox.date.tests.posix");
-dojo.require("dojox.date.posix");
-
-tests.register("dojox.date.tests.posix",
- [
-
- //FIXME: set up by loading 'en' resources
-function test_date_strftime(t){
- var date = new Date(2006, 7, 11, 0, 55, 12, 3456);
- t.is("06/08/11", dojox.date.posix.strftime(date, "%y/%m/%d"));
-
- var dt = null; // Date to test
- var fmt = ''; // Format to test
- var res = ''; // Expected result
-
- dt = new Date(2006, 0, 1, 18, 23);
- fmt = '%a';
- res = 'Sun';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%A';
- res = 'Sunday';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%b';
- res = 'Jan';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%B';
- res = 'January';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%c';
- res = 'Sunday, January 1, 2006 6:23:00 PM';
- t.is(res, dojox.date.posix.strftime(dt, fmt).substring(0, res.length));
-
- fmt = '%C';
- res = '20';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%d';
- res = '01';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%D';
- res = '01/01/06';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%e';
- res = ' 1';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%h';
- res = 'Jan';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%H';
- res = '18';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%I';
- res = '06';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%j';
- res = '001';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%k';
- res = '18';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%l';
- res = ' 6';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%m';
- res = '01';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%M';
- res = '23';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%p';
- res = 'PM';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%r';
- res = '06:23:00 PM';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%R';
- res = '18:23';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%S';
- res = '00';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%T';
- res = '18:23:00';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%u';
- res = '7';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%w';
- res = '0';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%x';
- res = 'Sunday, January 1, 2006';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en'));
-
- fmt = '%X';
- res = '6:23:00 PM';
- t.is(res, dojox.date.posix.strftime(dt, fmt, 'en').substring(0,res.length));
-
- fmt = '%y';
- res = '06';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%Y';
- res = '2006';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-
- fmt = '%%';
- res = '%';
- t.is(res, dojox.date.posix.strftime(dt, fmt));
-},
-function test_date_getStartOfWeek(t){
- var weekStart;
-
- // Monday
- var date = new Date(2007, 0, 1);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 1), 1);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 2), 1);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 3), 1);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 4), 1);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 5), 1);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 6), 1);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 7), 1);
- t.is(date, weekStart);
-
- // Sunday
- date = new Date(2007, 0, 7);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 7), 0);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 8), 0);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 9), 0);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 10), 0);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 11), 0);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 12), 0);
- t.is(date, weekStart);
- weekStart = dojox.date.posix.getStartOfWeek(new Date(2007, 0, 13), 0);
- t.is(date, weekStart);
-},
-
-function test_date_setIsoWeekOfYear(t){
- var date = new Date(2006,10,10);
- var result = dojox.date.posix.setIsoWeekOfYear(date, 1);
- t.is(new Date(2006,0,6), result);
- result = dojox.date.posix.setIsoWeekOfYear(date, 10);
- result = dojox.date.posix.setIsoWeekOfYear(date, 2);
- t.is(new Date(2006,0,13), result);
- result = dojox.date.posix.setIsoWeekOfYear(date, 10);
- t.is(new Date(2006,2,10), result);
- result = dojox.date.posix.setIsoWeekOfYear(date, 52);
- t.is(new Date(2006,11,29), result);
- var result = dojox.date.posix.setIsoWeekOfYear(date, -1);
- t.is(new Date(2006,11,29), result);
- var result = dojox.date.posix.setIsoWeekOfYear(date, -2);
- t.is(new Date(2006,11,22), result);
- var result = dojox.date.posix.setIsoWeekOfYear(date, -10);
- t.is(new Date(2006,9,27), result);
-
- date = new Date(2004,10,10);
- result = dojox.date.posix.setIsoWeekOfYear(date, 1);
- t.is(new Date(2003,11,31), result);
- result = dojox.date.posix.setIsoWeekOfYear(date, 2);
- t.is(new Date(2004,0,7), result);
- result = dojox.date.posix.setIsoWeekOfYear(date, -1);
- t.is(new Date(2004,11,29), result);
-},
-
-function test_date_getIsoWeekOfYear(t){
- var week = dojox.date.posix.getIsoWeekOfYear(new Date(2006,0,1));
- t.is(52, week);
- week = dojox.date.posix.getIsoWeekOfYear(new Date(2006,0,4));
- t.is(1, week);
- week = dojox.date.posix.getIsoWeekOfYear(new Date(2006,11,31));
- t.is(52, week);
- week = dojox.date.posix.getIsoWeekOfYear(new Date(2007,0,1));
- t.is(1, week);
- week = dojox.date.posix.getIsoWeekOfYear(new Date(2007,11,31));
- t.is(53, week);
- week = dojox.date.posix.getIsoWeekOfYear(new Date(2008,0,1));
- t.is(1, week);
- week = dojox.date.posix.getIsoWeekOfYear(new Date(2007,11,31));
- t.is(53, week);
-},
-
-function test_date_getIsoWeeksInYear(t){
- // 44 long years in a 400 year cycle.
- var longYears = [4, 9, 15, 20, 26, 32, 37, 43, 48, 54, 60, 65, 71, 76, 82,
- 88, 93, 99, 105, 111, 116, 122, 128, 133, 139, 144, 150, 156, 161, 167,
- 172, 178, 184, 189, 195, 201, 207, 212, 218, 224, 229, 235, 240, 246,
- 252, 257, 263, 268, 274, 280, 285, 291, 296, 303, 308, 314, 320, 325,
- 331, 336, 342, 348, 353, 359, 364, 370, 376, 381, 387, 392, 398];
-
- var i, j, weeks, result;
- for(i=0; i < 400; i++) {
- weeks = 52;
- if(i == longYears[0]) { weeks = 53; longYears.shift(); }
- result = dojox.date.posix.getIsoWeeksInYear(new Date(2000 + i, 0, 1));
- t.is(/*weeks +" weeks in "+ (2000+i), */weeks, result);
- }
-}
- ]
-);
-
-}
diff --git a/includes/js/dojox/date/tests/runTests.html b/includes/js/dojox/date/tests/runTests.html
deleted file mode 100644
index 57f6ba1..0000000
--- a/includes/js/dojox/date/tests/runTests.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
- <head>
- <title>Dojox Unit Test Runner</title>
- <meta http-equiv="REFRESH" content="0;url=../../../util/doh/runner.html?testModule=dojox.date.tests.module"></HEAD>
- <BODY>
- Redirecting to D.O.H runner.
- </BODY>
-</HTML>