optimizing date format converter regex
authorDaniel Rudolf <rudolf@eifel-online.com>
Thu, 24 Jan 2013 14:23:53 +0000 (15:23 +0100)
committerDaniel Rudolf <rudolf@eifel-online.com>
Thu, 24 Jan 2013 14:23:53 +0000 (15:23 +0100)
wcfsetup/install/files/js/WCF.js

index 9d6d0f55483c3a89a7cfb0c5d08e1222ebd18d55..997baeece5be16daec5808a143865d504dbfafb2 100755 (executable)
@@ -2158,7 +2158,7 @@ WCF.Date.Picker = {
                // do the actual replacement
                // this is not perfect, but a basic implementation and should work in 99% of the cases
                // TODO: support literals (magics are escaped in PHP date() by an \, in jQuery UI DatePicker they are enclosed in '')
-               this._dateFormat = format.replace(/([^dDjlzFmMnoYyU\\]*(?:\\.[^dDjlzFmMnoYyU\\]*)*)(d|D|j|l|z|F|m|M|n|o|Y|y|U)/g, function(match, part1, part2, offset, string) {
+               this._dateFormat = format.replace(/([^dDjlzFmMnoYyU\\]*(?:\\.[^dDjlzFmMnoYyU\\]*)*)([dDjlzFmMnoYyU]{1})/g, function(match, part1, part2, offset, string) {
                        $.each(replacementTable, function(key, item) {
                                if(part2 == key) {
                                        part2 = item;