Sha256: b09748f6739fd428bc5326c0319ff59f2b991dad0bfa202d0025cca9f7cb6cf9

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

// ==========================================================================
// Project:   SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 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 date if a value is given",function(){
  
    var num = 1234947136000; // represents time in secs
    var c = SC.Validator.Date.fieldValueForObject(1234947136000,'','');
    equals(YES,c === "Feb 18, 2009 12:52:16 AM","Number converted to date format");
});

test("Converts into number when date string is given", function(){
    var da = "Feb 18, 2009 12:52:16 AM"; // date string
    var d = SC.Validator.Date.objectForFieldValue("Feb 18, 2009 12:52:16 AM",'','');
    equals(YES,d === 1234947136000,"Date String compared with value in seconds");
    equals(YES,SC.typeOf(d) == "number","Number is obtained"); 	
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sproutcore-1.4.0.rc.3 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.4.0.rc.2 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.4.0.rc lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.0.1049.pre.2 lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js
sproutcore-1.0.1049.pre.1 frameworks/sproutcore/frameworks/foundation/tests/validators/date.js