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
michael@0 | 1 | function test_full() { |
michael@0 | 2 | var date = new Date(); |
michael@0 | 3 | var scriptableDateServ = |
michael@0 | 4 | Components.classes["@mozilla.org/intl/scriptabledateformat;1"].createInstance(Components.interfaces.nsIScriptableDateFormat); |
michael@0 | 5 | |
michael@0 | 6 | var dateStrXpcom = scriptableDateServ.FormatDateTime("", |
michael@0 | 7 | scriptableDateServ.dateFormatLong, scriptableDateServ.timeFormatSeconds, |
michael@0 | 8 | date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), |
michael@0 | 9 | date.getMinutes(), date.getSeconds()); |
michael@0 | 10 | |
michael@0 | 11 | var dateStrJs = date.toLocaleString(); |
michael@0 | 12 | |
michael@0 | 13 | do_check_eq(dateStrXpcom, dateStrJs); |
michael@0 | 14 | |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | function test_kTimeFormatSeconds() { |
michael@0 | 18 | var date = new Date(); |
michael@0 | 19 | var scriptableDateServ = |
michael@0 | 20 | Components.classes["@mozilla.org/intl/scriptabledateformat;1"].createInstance(Components.interfaces.nsIScriptableDateFormat); |
michael@0 | 21 | |
michael@0 | 22 | var dateStrXpcom = scriptableDateServ.FormatDateTime("", |
michael@0 | 23 | scriptableDateServ.dateFormatLong, scriptableDateServ.timeFormatNone, |
michael@0 | 24 | date.getFullYear(), date.getMonth()+1, date.getDate(), date.getHours(), |
michael@0 | 25 | date.getMinutes(), date.getSeconds()); |
michael@0 | 26 | |
michael@0 | 27 | var dateStrJs = date.toLocaleDateString() |
michael@0 | 28 | |
michael@0 | 29 | do_check_eq(dateStrXpcom, dateStrJs); |
michael@0 | 30 | |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function run_test() |
michael@0 | 34 | { |
michael@0 | 35 | // XXX test disabled due to bug 421790 |
michael@0 | 36 | return; |
michael@0 | 37 | test_full(); |
michael@0 | 38 | test_kTimeFormatSeconds(); |
michael@0 | 39 | } |