// Date Format
try {
var match;
- var date_format_patt=/%DATE_FORMAT\(([^,]*),([^)]*)\)%/
- while(match = date_format_patt.exec(s))
- s = s.replace(match[0], util.date.formatted_date(match[1], match[2]));
+ var date_format_patt=/%DATE_FORMAT\(\s*([^,]*?)\s*,\s*([^)]*?)\s*\)%/
+ while(match = date_format_patt.exec(s)) {
+ if(match[1] == '' || match[2] == '')
+ s = s.replace(match[0], '');
+ else
+ s = s.replace(match[0], util.date.formatted_date(match[1], match[2]));
+ }
} catch(E) { dump(E+'\n'); }
// Substrings