web/test/jstests/test_datetime.js
author Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
Thu, 03 Jun 2010 14:51:42 +0200
changeset 5658 7b9553a9db65
permissions -rw-r--r--
[ajax] refactor/cleanup low-level ajax functions * loadxhtml/replacePageChunck/reload_component/reload_box deprecated in favor of loadXHTML / ajaxFuncArgs * some other cleanups in cubicweb.ajax.js * add js_render which will replace js_component (more generic, nicer argument passing handling)

$(document).ready(function() {

  module("datetime tests");

  test("test full datetime", function() {
      equals(cw.utils.toISOTimestamp(new Date(1986, 3, 18, 10, 30, 0, 0)),
	     '1986-04-18 10:30:00');
  });

  test("test only date", function() {
      equals(cw.utils.toISOTimestamp(new Date(1986, 3, 18)), '1986-04-18 00:00:00');
  });

  test("test null", function() {
      equals(cw.utils.toISOTimestamp(null), null);
  });


});