Opened 10 years ago

Closed 9 years ago

#11198 closed defect (fixed)

dojo.date.locale test failure

Reported by: bill Owned by: Adam Peller
Priority: high Milestone: 1.5
Component: Date Version: 1.5.0b2
Keywords: Cc:
Blocked By: Blocking:

Description

It's failing on my machine, on IE8, due to a timezone problem (notice the +9:00 in the failure message:

_AssertFailure: [object Error]: assertEqual() failed: expected 上午12时55分12秒 but got +09:00上午12时55分12秒 [object Error] ERROR IN: function(t){ var date = new Date(2006, 7, 11, 0, 55, 12, 345); t.is("Friday, August 11, 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'en-us'})); t.is("vendredi 11 ao\xFBt 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'fr-fr'})); t.is("Freitag, 11. August 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'de-at'})); t.is("2006\u5E748\u670811\u65E5\u91D1\u66DC\u65E5", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'ja-jp'})); t.is("8/11/06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'en-us'})); t.is("11/08/06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'fr-fr'})); t.is("11.08.06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'de-at'})); t.is("06/08/11", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'ja-jp'})); t.is("6", dojo.date.locale.format(date, {datePattern:'E', selector:'date'})); t.is("12:55 AM", dojo.date.locale.format(date, {formatLength:'short',selector:'time', locale:'en-us'})); t.is("12:55:12", dojo.date.locale.format(date, {timePattern:'h:m:s',selector:'time'})); t.is("12:55:12.35", dojo.date.locale.format(date, {timePattern:'h:m:s.SS',selector:'time'})); t.is("24:55:12.35", dojo.date.locale.format(date, {timePattern:'k:m:s.SS',selector:'time'})); t.is("0:55:12.35", dojo.date.locale.format(date, {timePattern:'H:m:s.SS',selector:'time'})); t.is("0:55:12.35", dojo.date.locale.format(date, {timePattern:'K:m:s.SS',selector:'time'})); t.is("11082006", dojo.date.locale.format(date, {datePattern:"ddMMyyyy", selector:"date"})); t.is("12 o'clock AM", dojo.date.locale.format(date, {datePattern:"hh 'o''clock' a", selector:"date", locale: 'en'})); compare without timezone t.is("\u4e0a\u534812\u65f655\u520612\u79d2", dojo.date.locale.format(date, {formatLength:'full',selector:'time', locale:'zh-cn'}).substring(3)); } FAILED test: format 16 ms

Change History (6)

comment:1 Changed 10 years ago by Adam Peller

Milestone: tbd1.5
Priority: normalhigh

comment:2 Changed 9 years ago by Adam Peller

Resolution: fixed
Status: newclosed

(In [22246]) Ignore Timezone prefixes like +09:00 Fixes #11198

comment:3 Changed 9 years ago by Adam Peller

(In [22414]) Another attempt to ignore timezone prefixes. Refs #11198 Fixes #11409

comment:4 Changed 9 years ago by bill

Resolution: fixed
Status: closedreopened

Still fails for me, on IE8, same error as before:

    _AssertFailure: [object Error]: assertEqual() failed:  expected 上午12时55分12秒 but got +09:00上午12时55分12秒  [object Error]     ERROR IN:  function(t){ var date = new Date(2006, 7, 11, 0, 55, 12, 345); t.is("Friday, August 11, 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'en-us'})); t.is("vendredi 11 ao\xFBt 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'fr-fr'})); t.is("Freitag, 11. August 2006", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'de-at'})); t.is("2006\u5E748\u670811\u65E5\u91D1\u66DC\u65E5", dojo.date.locale.format(date, {formatLength:'full',selector:'date', locale:'ja-jp'})); t.is("8/11/06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'en-us'})); t.is("11/08/06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'fr-fr'})); t.is("11.08.06", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'de-at'})); t.is("06/08/11", dojo.date.locale.format(date, {formatLength:'short',selector:'date', locale:'ja-jp'})); t.is("6", dojo.date.locale.format(date, {datePattern:'E', selector:'date'})); t.is("12:55 AM", dojo.date.locale.format(date, {formatLength:'short',selector:'time', locale:'en-us'})); t.is("12:55:12", dojo.date.locale.format(date, {timePattern:'h:m:s',selector:'time'})); t.is("12:55:12.35", dojo.date.locale.format(date, {timePattern:'h:m:s.SS',selector:'time'})); t.is("24:55:12.35", dojo.date.locale.format(date, {timePattern:'k:m:s.SS',selector:'time'})); t.is("0:55:12.35", dojo.date.locale.format(date, {timePattern:'H:m:s.SS',selector:'time'})); t.is("0:55:12.35", dojo.date.locale.format(date, {timePattern:'K:m:s.SS',selector:'time'})); t.is("11082006", dojo.date.locale.format(date, {datePattern:"ddMMyyyy", selector:"date"})); t.is("12 o'clock AM", dojo.date.locale.format(date, {datePattern:"hh 'o''clock' a", selector:"date", locale: 'en'})); // compare without timezone t.is("\u4e0a\u534812\u65f655\u520612\u79d2", dojo.date.locale.format(date, {formatLength:'full',selector:'time', locale:'zh-cn'}).replace(/^(\+\d*(:\d*)?)|[A-Za-z ]*/,"")); } FAILED test: format 0 ms

comment:5 Changed 9 years ago by Adam Peller

one more attempt at a patch. Bill, can you try this:

Index: locale.js
===================================================================
--- locale.js	(revision 22477)
+++ locale.js	(working copy)
@@ -74,7 +74,7 @@
 	t.is("12 o'clock AM", dojo.date.locale.format(date, {datePattern:"hh 'o''clock' a", selector:"date", locale: 'en'}));
 
 	// compare without timezone
-	t.is("\u4e0a\u534812\u65f655\u520612\u79d2", dojo.date.locale.format(date, {formatLength:'full',selector:'time', locale:'zh-cn'}).replace(/^(\+\d*(:\d*)?)|[A-Za-z ]*/,""));
+	t.is("\u4e0a\u534812\u65f655\u520612\u79d2", dojo.date.locale.format(date, {formatLength:'full',selector:'time', locale:'zh-cn'}).replace(/^.*(\u4e0a\u5348.*)/,"$1"));
 			}
 		},
 		{

comment:6 Changed 9 years ago by bill

Resolution: fixed
Status: reopenedclosed

(In [22478]) patch from Adam to ignore timezone, fixes #11198

Note: See TracTickets for help on using tickets.