Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 function test_full() {
2 var date = new Date();
3 var scriptableDateServ =
4 Components.classes["@mozilla.org/intl/scriptabledateformat;1"].createInstance(Components.interfaces.nsIScriptableDateFormat);
6 var dateStrXpcom = scriptableDateServ.FormatDateTime("",
7 scriptableDateServ.dateFormatLong, scriptableDateServ.timeFormatSeconds,
8 date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(),
9 date.getMinutes(), date.getSeconds());
11 var dateStrJs = date.toLocaleString();
13 do_check_eq(dateStrXpcom, dateStrJs);
15 }
17 function test_kTimeFormatSeconds() {
18 var date = new Date();
19 var scriptableDateServ =
20 Components.classes["@mozilla.org/intl/scriptabledateformat;1"].createInstance(Components.interfaces.nsIScriptableDateFormat);
22 var dateStrXpcom = scriptableDateServ.FormatDateTime("",
23 scriptableDateServ.dateFormatLong, scriptableDateServ.timeFormatNone,
24 date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(),
25 date.getMinutes(), date.getSeconds());
27 var dateStrJs = date.toLocaleDateString()
29 do_check_eq(dateStrXpcom, dateStrJs);
31 }
33 function run_test()
34 {
35 // XXX test disabled due to bug 421790
36 return;
37 test_full();
38 test_kTimeFormatSeconds();
39 }