utils.js 617 B

123456789101112131415161718192021
  1. function UTCDate(){
  2. return new Date(Date.UTC.apply(Date, arguments));
  3. }
  4. function format_date(date){
  5. var y = date.getUTCFullYear(),
  6. m = date.getUTCMonth() + 1,
  7. d = date.getUTCDate(),
  8. h = date.getUTCHours(),
  9. i = date.getUTCMinutes(),
  10. s = date.getUTCSeconds(),
  11. l = date.getUTCMilliseconds();
  12. function z(i){return (i <= 9 ? '0'+i : i);}
  13. return y+'-'+z(m)+'-'+z(d)+' '+z(h)+':'+z(i)+':'+z(s)+'.'+z(l);
  14. }
  15. function datesEqual(actual, expected, message){
  16. QUnit.push(QUnit.equiv(actual, expected), format_date(actual), format_date(expected), message);
  17. }