question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question on usage of timezone in options

See original GitHub issue

What you are doing?

Let’s say we specify timezone as such:

var sequelize = new Sequelize({
    // ...
    timezone: "+08:00"
});

What do you expect to happen?

Assuming I have a column with Type: Sequelize.DATE

When I insert 2010-01-01 09:00 for that column, Sequelize stores 2010-01-01 09:00 into the database without converting the value to UTC timezone which is correct.

However, when I query for that same column, Sequelize then returns me 2010-01-01T09:00Z, with a Z at the back.

What is actually happening?

Shouldn’t the results be 2010-01-01T09:00+08:00 instead of 2010-01-01T09:00Z since the date is not in UTC timezone?

Dialect: mssql Database version: MSSQL 2014 Sequelize version: 3.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
harshithkashyapcommented, Apr 12, 2017

Since the datatypes are different, if we change it on v3, sequelize models will use DATETIMEOFFSET but the database has DATETIME2 datatype. You would need to convert the existing datetime2 to datetimeoffset. If you create new tables without datatype​ change, you’ll have some in old datatype and some in new. Hence it’s a BC. You can submit a PR to v3 and add a note in change log under BC section.

0reactions
iamjoycecommented, Apr 12, 2017

@harshithkashyap Do you mind elaborating on why is this a breaking change? I was comparing the files in master and v3 in this case, and I think v3 can be modified the same way.

I can submit a PR to v3, just that I am curious on why is this counted as a breaking change.

Are you referring to this - #7419?

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a template question to ask respondents their time zone?
I am trying to ask respondents a question: "What time zone will you be based in, at least for the fall semester (September-December)?"....
Read more >
Working with Time Zones - W3C
A time zone is a set of rules for determining the local observed time (wall time) as it relates to incremental time (as...
Read more >
Why are there multiple timezone choices that all resolve to EST?
So, what one could conclude from this is that a timezone for a particular City is based on its zone boundaries, its daylight...
Read more >
Using time zone settings | Looker - Google Cloud
The Application Time Zone is the default time zone for content deliveries. The time zone used for content deliveries does not affect time-based ......
Read more >
Time zones - Django documentation
How can I obtain the local time in the current time zone? Well, the first question is, do you really need to? You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found