Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The parse date string can now be customized. The option is parseRe in…
… lang file.
  • Loading branch information
tonytomov committed May 6, 2013
1 parent 1e81d0c commit 339c5c8
Show file tree
Hide file tree
Showing 44 changed files with 70 additions and 25 deletions.
8 changes: 6 additions & 2 deletions js/grid.base.js
Expand Up @@ -97,6 +97,10 @@ $.extend($.jgrid,{
if(opts === undefined) {
opts = $.jgrid.formatter.date;
}
// old lang files
if(opts.parseRe === undefined ) {
opts.parseRe = /[Tt\\\/:_;.,\t\s-]/;
}
if( opts.masks.hasOwnProperty(format) ) { format = opts.masks[format]; }
if( !isNaN( date - 0 ) && String(format).toLowerCase() === "u") {
//Unix timestamp
Expand All @@ -113,8 +117,8 @@ $.extend($.jgrid,{
timestamp.setTime(Number(Number(timestamp) + (offset * 60 * 1000)));
}
} else {
date = String(date).replace(/\\T/g,"T").replace(/\\t/,"t").split(/[Tt\\\/:_;.,\t\s-]/);
format = format.replace(/\\T/g,"T").replace(/\\t/,"t").split(/[Tt\\\/:_;.,\t\s-]/);
date = String(date).replace(/\\T/g,"T").replace(/\\t/,"t").split(opts.parseRe);
format = format.replace(/\\T/g,"T").replace(/\\t/,"t").split(opts.parseRe);
// parsing for month names
for(k=0,hl=format.length;k<hl;k++){
if(format[k] === 'M') {
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-ar.js
Expand Up @@ -102,6 +102,7 @@ $.extend($.jgrid,{
S: function (j) {return j == 1 ? 'er' : 'e';},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-bg.js
Expand Up @@ -108,6 +108,7 @@ $.extend($.jgrid,{
},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-bg1251.js
Expand Up @@ -108,6 +108,7 @@ $.extend($.jgrid,{
},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-cat.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd-m-Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-cn.js
Expand Up @@ -108,6 +108,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'm-d-Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-cs.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-da.js
Expand Up @@ -103,6 +103,7 @@ $.extend($.jgrid,{
S: function (j) {return '.'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-de.js
Expand Up @@ -114,6 +114,7 @@ $.extend($.jgrid,{
S: function (j) {return '.';}, // one can also use 'er' instead of '.' but one have to use additional word like 'der' or 'den' before
srcformat: 'Y-m-d',
newformat: 'd.m.Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
// and see http://docs.jquery.com/UI/Datepicker/formatDate
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-dk.js
Expand Up @@ -102,6 +102,7 @@ $.jgrid = {
S: function (j) {return '.'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-el.js
Expand Up @@ -102,6 +102,7 @@ $.extend($.jgrid,{
S: function (j) {return j == 1 || j > 1 ? ['η'][Math.min((j - 1) % 10, 3)] : ''},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-en.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th';},
srcformat: 'Y-m-d',
newformat: 'n/j/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
// and see http://docs.jquery.com/UI/Datepicker/formatDate
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-es.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd-m-Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-fa.js
Expand Up @@ -119,6 +119,7 @@
},
srcformat: "Y-m-d",
newformat: "d/m/Y",
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks: {
ISO8601Long: "Y-m-d H:i:s",
ISO8601Short: "Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-fi.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd.m.Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks: {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-fr.js
Expand Up @@ -102,6 +102,7 @@ $.extend($.jgrid,{
S: function (j) {return j == 1 ? 'er' : 'e';},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-gl.js
Expand Up @@ -102,6 +102,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd-m-Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-he.js
Expand Up @@ -103,6 +103,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['', '', '', ''][Math.min((j - 1) % 10, 3)] : ''},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-hr.js
Expand Up @@ -105,6 +105,7 @@ $.extend($.jgrid,{
S: function (j) {return ''},
srcformat: 'Y-m-d',
newformat: 'd.m.Y.',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
// and see http://docs.jquery.com/UI/Datepicker/formatDate
Expand Down
43 changes: 22 additions & 21 deletions js/i18n/grid.locale-hr1250.js
Expand Up @@ -13,14 +13,14 @@ $.extend($.jgrid,{
defaults : {
recordtext: "Pregled {0} - {1} od {2}",
emptyrecords: "Nema zapisa",
loadtext: "Uèitavam...",
loadtext: "U�itavam...",
pgtext : "Stranica {0} od {1}"
},
search : {
caption: "Traži...",
Find: "Pretraživanje",
Reset: "Poništi",
odata : ['jednak', 'nije identièan', 'manje', 'manje ili identièno','veæe','veše ili identièno', 'poèinje sa','ne poèinje sa ','je u','nije u','završava sa','ne završava sa','sadrži','ne sadrži'],
caption: "Tra�i...",
Find: "Pretra�ivanje",
Reset: "Poni�ti",
odata : ['jednak', 'nije identi�an', 'manje', 'manje ili identi�no','ve�e','ve�e ili identi�no', 'po�inje sa','ne po�inje sa ','je u','nije u','zavr�ava sa','ne zavr�ava sa','sadr�i','ne sadr�i'],
groupOps: [ { op: "I", text: "sve" }, { op: "ILI", text: "bilo koji" } ],
matchText: " podudata se",
rulesText: " pravila"
Expand All @@ -38,8 +38,8 @@ $.extend($.jgrid,{
msg: {
required:"Polje je obavezno",
number:"Molim, unesite ispravan broj",
minValue:"Vrijednost mora biti veæa ili identièna ",
maxValue:"Vrijednost mora biti manja ili identièna",
minValue:"Vrijednost mora biti ve�a ili identi�na ",
maxValue:"Vrijednost mora biti manja ili identi�na",
email: "neispravan e-mail",
integer: "Molim, unjeti ispravan cijeli broj (integer)",
date: "Molim, unjeti ispravan datum ",
Expand All @@ -56,55 +56,56 @@ $.extend($.jgrid,{
bClose: "Zatvori"
},
del : {
caption: "Obriši",
msg: "Obriši oznaèen zapis ili više njih?",
bSubmit: "Obriši",
caption: "Obri�i",
msg: "Obri�i ozna�en zapis ili vi�e njih?",
bSubmit: "Obri�i",
bCancel: "Odustani"
},
nav : {
edittext: " ",
edittitle: "Promijeni obilježeni red",
edittitle: "Promijeni obilje�eni red",
addtext:" ",
addtitle: "Dodaj novi red",
deltext: " ",
deltitle: "Obriši obilježeni red",
deltitle: "Obri�i obilje�eni red",
searchtext: " ",
searchtitle: "Potraži zapise",
searchtitle: "Potra�i zapise",
refreshtext: "",
refreshtitle: "Ponovo preuzmi podatke",
alertcap: "Upozorenje",
alerttext: "Molim, odaberi red",
viewtext: "",
viewtitle: "Pregled obilježenog reda"
viewtitle: "Pregled obilje�enog reda"
},
col : {
caption: "Obilježi kolonu",
caption: "Obilje�i kolonu",
bSubmit: "Uredu",
bCancel: "Odustani"
},
errors : {
errcap : "Greška",
errcap : "Gre�ka",
nourl : "Nedostaje URL",
norecords: "Bez zapisa za obradu",
model : "colNames i colModel imaju razlièitu duljinu!"
model : "colNames i colModel imaju razli�itu duljinu!"
},
formatter : {
integer : {thousandsSeparator: ".", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:" Kn", defaultValue: '0,00'},
date : {
dayNames: [
"Ned", "Pon", "Uto", "Sri", "Èet", "Pet", "Sub",
"Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Èetvrtak", "Petak", "Subota"
"Ned", "Pon", "Uto", "Sri", "�et", "Pet", "Sub",
"Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "�etvrtak", "Petak", "Subota"
],
monthNames: [
"Sij", "Vel", "Ožu", "Tra", "Svi", "Lip", "Srp", "Kol", "Ruj", "Lis", "Stu", "Pro",
"Sijeèanj", "Veljaèa", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
"Sij", "Vel", "O�u", "Tra", "Svi", "Lip", "Srp", "Kol", "Ruj", "Lis", "Stu", "Pro",
"Sije�anj", "Velja�a", "O�ujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return ''},
srcformat: 'Y-m-d',
newformat: 'd.m.Y.',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
// and see http://docs.jquery.com/UI/Datepicker/formatDate
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-hu.js
Expand Up @@ -105,6 +105,7 @@ $.extend($.jgrid,{
S: function (j) {return '.-ik';},
srcformat: 'Y-m-d',
newformat: 'Y/m/d',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-id.js
Expand Up @@ -107,6 +107,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th';},
srcformat: 'Y-m-d',
newformat: 'n/j/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
// see http://php.net/manual/en/function.date.php for PHP format used in jqGrid
// and see http://docs.jquery.com/UI/Datepicker/formatDate
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-is.js
Expand Up @@ -102,6 +102,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
2 changes: 1 addition & 1 deletion js/i18n/grid.locale-it.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/i18n/grid.locale-ja.js
Expand Up @@ -131,6 +131,7 @@ $.extend($.jgrid,{
S: function (j) { return "\u756a\u76ee"; },
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-kr.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'm-d-Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-lt.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-mne.js
Expand Up @@ -104,6 +104,7 @@ $.extend($.jgrid,{
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd/m/Y',
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
Expand Down
1 change: 1 addition & 0 deletions js/i18n/grid.locale-nl.js
Expand Up @@ -120,6 +120,7 @@ a.extend(a.jgrid,{
},
srcformat: "Y-m-d",
newformat: "d/m/Y",
parseRe : /[Tt\\\/:_;.,\t\s-]/,
masks:
{
ISO8601Long: "Y-m-d H:i:s",
Expand Down

0 comments on commit 339c5c8

Please sign in to comment.