I’m using JQGrid to display my data (the server returns xml). The data seems to be OK:
<aux>
<sessao>181092</sessao>
<codFuncionario>13574</codFuncionario>
<dataMarcacao class="sql-date">2011-10-15</dataMarcacao>
<sequencia>1</sequencia>
<seqHe/>
<codPagamento/>
<seqOcorrencia>0</seqOcorrencia>
<tipoOcorrencia/>
<diaSemana>SAB</diaSemana>
</aux>
<aux>
<sessao>181092</sessao>
<codFuncionario>13574</codFuncionario>
<dataMarcacao class="sql-date">2011-10-16</dataMarcacao>
<sequencia>1</sequencia>
<seqHe/>
<codPagamento/>
<seqOcorrencia>0</seqOcorrencia>
<tipoOcorrencia/>
<diaSemana>DOM</diaSemana>
<inconsistencias>FALTA DIA</inconsistencias>
</aux>
On the init of the grid I setup the format:
colModel:[ {name: 'dataMarcacao',
index: 'dataMarcacao',
width: 60,
formatter: 'date',
formatoptions: {newformat: 'd/m/Y', datefmt: 'Y-m-d'}},
What I don’t understand is that the grid shows 15/10/2011 twice, instead of 16/10/2011.
How can I debug this? Maybe JQGrid bug?
I also try:
colModel:[ {name: 'dataMarcacao',
index: 'dataMarcacao',
width: 60,
formatter: 'date',
formatoptions: {newformat: 'Y-m-d', datefmt: 'Y-m-d'}},
and this gets the same wrong result.
Sérgio Michels answered this in his own question, I cleaned it up below:
This seems to be a bug with PDT. Firebug shown the timestamps:
Date {Sat Oct 15 2011 00:00:00 GMT-0300 (Hora oficial do Brasil)}Date {Sat Oct 15 2011 23:00:00 GMT-0300 (Hora oficial do Brasil)}— this should be Oct 16!Date {Mon Oct 17 2011 00:00:00 GMT-0200}I found out that the problem is related to the SO and the JavaScript object
Date. In Windows, when you turn on the option to automatically update your clock time, the object `Date return your date minus one hour in your daylight saving time.To fix this i edited
jquery.jqGrid.src.json line 4667:instead of
j = timestamp.getDate().