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.

Unable to set the Indian standard time in timezone settings

See original GitHub issue

Issue Description

Hello, we are trying to set the timestamp to IST, i.e. Asia/Kolkata. But, we are getting IANA standard related errors while running queries on TIMESTAMP fields. If we change the timezone to New York/HongKong, it works. But somehow Asia/Kolkata doesn’t work.

What are you doing?

We are trying to query our database’s TIMESTAMP field and getting timezone related issues.

'use strict';
const Sequelize = require( 'sequelize');
const config = require("../../bin/config");
const mysql = require('mysql2/promise');

module.exports = {
	connectionPool : new Sequelize(config.cardplayDb.database, config.cardplayDb.user, config.cardplayDb.password, {
		timezone: 'Asia/Kolkata', //We tried, ETC/GMT0+05:30
		host: config.cardplayDb.host,
		dialect: 'mariadb',
		logging: config.cardplayDb.logginng,
		pool: {
			max: 5,
			min: 0,
			idle: 10000
		},
		dialectOptions: {
			useUTC : false
		}
	})
};

What do you expect to happen?

The code should take Indian standard time in consideration.

Additional context

We saw the following commit on mariadb v2.0.4 that tells to set the timezone to ‘auto’. The timezone in database is IST. Running the query with this setting results in error.

Our query through sequelize works fine in mariadb version 2.0.3. We didn’t have to set any timezone in it.

Note: We are running a raw query.

Environment

  • Sequelize version: 5.15.2
  • Node.js version: v10.16.3
  • Operating System: Centos 7.5
  • If TypeScript related: TypeScript version: NA

Issue Template Checklist

How does this problem relate to dialects?

  • I think this problem happens regardless of the dialect.
  • I think this problem happens only for the following dialect(s): mariadb
  • I don’t know, I was using PUT-YOUR-DIALECT-HERE, with connector library version XXX and database version XXX

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
  • Yes, I have the time but I don’t know how to start, I would need guidance.
  • No, I don’t have the time, although I believe I could do it if I had the time…
  • No, I don’t have the time and I wouldn’t even know how to start.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
prattscommented, Sep 30, 2019

Hello @sushantdhiman , We found another thing. If we set the timezone through the configurations: timezone: 'Asia/Calcutta', dialectOptions: { timezone: 'Asia/Calcutta', },

Then it queries the database datetime fields correctly.

Can you please tell how both timezone parameters work differently. Because omitting any of them fails the query.

Regards

1reaction
prattscommented, Oct 30, 2019

@papb : Yes it is correct. Removing either of the options doesn’t work. I need to add it to both options.

Read more comments on GitHub >

github_iconTop Results From Across the Web

There is no Indian time zone in the time zone list of windows 11
So i just updated windows 10 home to windows 11 home and i noticed that the time was wrong so i went adjust...
Read more >
Set time zone automatically for Indian St… - Apple Community
I tried setting the time zone to Coimbatore - India using "Set time zone automatically using current location" but I see the Time...
Read more >
Fix unable to change the time zone in windows 11 ... - YouTube
Change Time Zone in #windows11 #windows10 # timezones You can use a ... Time India Standard Time Iran Standard Time Israel Standard Time ......
Read more >
How to setup Time zone in Windows? - Anakage
Go to the “Time zone” drop-down menu and choose India Standard Time. How to setup Time zone in windows system? 2. Using Command...
Read more >
Changing Time Zone Settings in Windows via CMD ...
By default, Windows tries to automatically select the time zone (the Set time zone automatically option is enabled). You can disable this option ......
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