mysqljs/mysql

0000-00-00 00:00:00 timestamp is returned as a string

Open

#1040 aperta il 27 mar 2015

Vedi su GitHub
 (8 commenti) (0 reazioni) (1 assegnatario)JavaScript (2502 fork)batch import
help wantedquestion

Metriche repository

Star
 (18.137 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

this should be equal to new Date(0) I believe. Here is what i 've done to make sure I always get a date:

if (typeof result.my_col ==="string"){
              result.my_col=new Date(0);
}
/*instanceof Date can also be used
or to cover only that case something like this:
result.my_col ==="0000-00-00 00:00:00"
but I don't remember if the above was the exact string given
*/

The rest of the timestamps is returned as dates so I wouldn't expect this behavior

Guida contributor