Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
TiddlyWiki core tests - improved date conversion tests
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
s...@tiddlywiki.org  
View profile  
 More options Nov 9, 8:10 am
From: s...@tiddlywiki.org
Date: Mon, 09 Nov 2009 05:10:57 -0800
Local: Mon, Nov 9 2009 8:10 am
Subject: [commit #11208] TiddlyWiki core tests - improved date conversion tests
http://trac.tiddlywiki.org/changeset/11208

MartinBudden
2009-11-09 05:10:57 -0800 (Mon, 09 Nov 2009)
54
TiddlyWiki core tests - improved date conversion tests

---------------

U   Trunk/core/test/js/Dates.js

---------------

Modified: Trunk/core/test/js/Dates.js
===================================================================
--- Trunk/core/test/js/Dates.js 2009-11-09 12:38:17 UTC (rev 11207)
+++ Trunk/core/test/js/Dates.js 2009-11-09 13:10:57 UTC (rev 11208)
@@ -431,5 +431,36 @@
                expected = "YY";
                same(actual,expected,'should not convert escaped two-digit year format');
        });
+
+       test("Date: conversions", function() {
+               same(typeof Date.convertFromYYYYMMDDHHMMSSMMM,"function",'should parse define a function');
+               same(typeof Date.convertFromYYYYMMDDHHMMSSMMM("20070228"),"object",'should return an object');
+               equals(Date.convertFromYYYYMMDDHHMMSSMMM(),"Invalid Date",'should parse null value should be invalid');
+               equals(Date.convertFromYYYYMMDDHHMMSSMMM("2006"),"Invalid Date",'should parse year only should be invalid');
+               equals(Date.convertFromYYYYMMDDHHMMSSMMM("20061"),"Invalid Date",'should parse year, short month only should be invalid');
+               equals(Date.convertFromYYYYMMDDHHMMSSMMM("200601"),"Invalid Date",'should parse year,month only should be invalid');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("20070228"),new Date(Date.UTC(2007,1,28)),'should parse date only');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("19691103"),new Date(Date.UTC(1969,10,3)),'should parse 1969 date only');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("2006011"),new Date(Date.UTC(2006,0,1)),'should parse year,month, short day');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("199912079"),new Date(Date.UTC(1999,11,7,9)),'should parse year,month,day short hour');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("1999121712"),new Date(Date.UTC(1999,11,17,12)),'should parse year,month,day,hour');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("199912598"),new Date(Date.UTC(1999,11,59,8)),'should parse year,month,day,hour short mins');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("199912150257"),new Date(Date.UTC(1999,11,15,2,57)),'should parse year,month,day,hour,mins');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("1999121512579"),new Date(Date.UTC(1999,11,15,12,57,9)),'should parse year,month,day,hour,mins,short secs');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("19991215125719"),new Date(Date.UTC(1999,11,15,12,57,19)),'should parse year,month,day,hour,mins,secs');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("199912151257198"),new Date(Date.UTC(1999,11,15,12,57,19,8)),'should parse year,month,day,hour,mins,secs,short milliseconds');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("1999121512571978"),new Date(Date.UTC(1999,11,15,12,57,19,78)),'should parse year,month,day,hour,mins,secs,medium milliseconds');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("19991215125719678"),new Date(Date.UTC(1999,11,15,12,57,19,678)),'should parse year,month,day,hour,mins,secs,long milliseconds');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("1999-12-15.12:57:19.678"),new Date(Date.UTC(1999,11,15,12,57,19,678)),'should parse ignoring punctuation');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("  1999/12/15   12:57:19  678    "),new Date(Date.UTC(1999,11,15,12,57,19,678)),'should parse ignoring whitespace');
+               same(Date.convertFromYYYYMMDDHHMMSSMMM("  1999/12/15   12:57:19  678  GMT (BST)  "),new Date(Date.UTC(1999,11,15,12,57,19,678)),'should parse ignoring trailing text');
+               same(Date.convertFromYYYYMMDDHHMM("  1999/12/15   12:57:19  678  GMT (BST)  "),new Date(Date.UTC(1999,11,15,12,57,0,0)),'should parse ignoring whitespace, punctuation and trailing text');
+               var d1 = new Date(Date.UTC(1987,09,29,21,43,57,678));
+               var s1 = d1.convertToYYYYMMDDHHMMSSMMM();
+               var d2 = Date.convertFromYYYYMMDDHHMMSSMMM(s1);
+               var s2 = d2.convertToYYYYMMDDHHMMSSMMM();
+               same(s2,s1,'should roundtrip current date from Date.convertToYYYYMMDDHHMMSSMMM');
+               same(d1,d2,'should roundtrip current date from Date.convertToYYYYMMDDHHMMSSMMM');
+       });
 });


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google