Skip to content

Date fields - timezone problem #149

Description

@euronymous

Hi,

I've spend the last hour for reverse engineering of that case...

Lets look at the file:
/loopback-connector-mysql/lib/mysql.js:353
val = new Date(val.toString().replace(/GMT.*$/, 'GMT'));
Why you don't give a sh about timezone?! This is at least weird.

Here is an example. I have a date from MySQL:
Mon Jun 01 2015 02:01:01 GMT+0200 (CEST)

So lets try:

        console.log(val);
        console.log(val.toString().replace(/GMT.*$/, 'GMT'));
        val = new Date(val.toString().replace(/GMT.*$/, 'GMT'));
        console.log(val);

And the result is:

        Mon Jun 01 2015 02:01:01 GMT+0200 (CEST)
        Mon Jun 01 2015 02:01:01 GMT
        Mon Jun 01 2015 04:01:01 GMT+0200 (CEST)

And at last the strongloop API response:
"2015-06-01T02:01:01.000Z"

Kind Regards,
Krzysiek

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions