Sha256: 05adf39576c6317e067e4b688b0aba45a560d9bc8f94bba09054449f2c66e092

Contents?: true

Size: 1.05 KB

Versions: 39

Compression:

Stored size: 1.05 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2011 Apple Inc. and contributors.
// License:   Licensed under MIT license (see license.js)
// ==========================================================================

/*global module test equals context ok same */

module("SC.Validator.Date");

test("Converts into String if a number is given",function() {
  var date = SC.DateTime.create({milliseconds: 1234947136000 + (new Date().getTimezoneOffset() * 60000)});

  var c = SC.Validator.Date.fieldValueForObject(date._ms, '', '');
  var expected = "Feb 18, 2009 8:52:16 AM";
  equals(c, expected, "Number converted to date format");
});

test("Converts into number when date string is given", function() {
  var expected = 1234918336000;
  var date = SC.DateTime.create(expected);
  var d = SC.Validator.Date.objectForFieldValue(date.toFormattedString('%b %d, %Y %i:%M:%S %p'),'','');
  equals(d, expected, "Number of milliseconds returned is correct");
});

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.11.0.rc3 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.11.0.rc2 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.11.0.rc1 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.10.3.1 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.10.2 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.10.1 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.10.0 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.10.0.rc.3 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.10.0.rc.2 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.10.0.rc.1 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.9.2 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.9.1 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.9.0 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.8.2.1 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.8.1 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.8.0 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.7.1.beta-java lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.7.1.beta lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.6.0.1-java lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js