Skip to content
This repository
Browse code

BUG Fix wrong date conversion from PHP format 'y' to jquery date and …

…back.

While 'y' in PHP means 4 digits year (e.g. 2012), jquery date picker means 2 digits (e.g. 12). That's all fine until then but when you pass the 2 digit year value back to PHP it all goes awry.
For exmple, defatult date format in en_US is 'MMM d, y' so in jquery date picker it's something like this 'Aug 22, 12' and eventually PHP will convert that value to '0012-08-22' which completely wrong.
  • Loading branch information...
commit f3fcae315d50b4792719964b1a3b9e8d57d4da9a 1 parent 14b8071
Saophalkun Ponlu authored chillu committed

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  forms/DateField.php
3  forms/DateField.php
@@ -591,7 +591,8 @@ static function convert_iso_to_jquery_format($format) {
591 591
 		  '/l/' => '',
592 592
 		  '/YYYY/' => 'yy',
593 593
 		  '/yyyy/' => 'yy',
594  
-		  '/[^y]yy[^y]/' => 'y',
  594
+		  // See http://open.silverstripe.org/ticket/7669
  595
+		  '/y{1,3}/' => 'yy',
595 596
 		  '/a/' => '',
596 597
 		  '/B/' => '',
597 598
 		  '/hh/' => '',

0 notes on commit f3fcae3

Please sign in to comment.
Something went wrong with that request. Please try again.