can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r22014: LJSUP-12126: Port choose date widget fro...

Committer: dpetrov
LJSUP-12126: Port choose date widget from the old update.bml page. Fix date format.
U   trunk/htdocs/js/basic.js
Modified: trunk/htdocs/js/basic.js
===================================================================
--- trunk/htdocs/js/basic.js	2012-05-21 14:09:28 UTC (rev 22013)
+++ trunk/htdocs/js/basic.js	2012-05-22 06:27:50 UTC (rev 22014)
@@ -360,13 +360,16 @@
 	LJ.Util.Date.parse = function(datestr, format) {
 		format = normalizeFormat(format);
 
+		//don't touch it if you can't use it
+		if (!datestr) { return datestr; }
+
 		var testStr = normalizeFormat(format),
 			positions = [ null ],
 			pos = 0, token,
 			regs = {
-				'%y' : '(\\d{4})',
-				'%m' : '(\\d{2})',
-				'%d' : '(\\d{2})'
+				'%Y' : '(\\d{4})',
+				'%M' : '(\\d{2})',
+				'%D' : '(\\d{2})'
 			};
 
 		while( ( pos = testStr.indexOf( '%', pos ) ) !== -1 ) {
@@ -375,6 +378,7 @@
 				testStr = testStr.replace( token, regs[ token ] );
 				positions.push( token );
 			} else {
+				pos += 2; //skip this token
 				positions.push( null );
 			}
 		}

Tags: can3p, dpetrov, js, livejournal
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments