New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permit force DATETIME timezone #92
Comments
|
Hello there, just to add a bit more details, here is the stacktrace after settings |
|
I have the Workaround:
Cause:
|
|
Same problem here ("mariadb": "2.1.4") When trying to set timezone |
Tnx, it looks like a temp solution |
|
adding it looks like the problem stems from the value @rusher this seems to be a fairly significant bug as it is causing the application to crash. Not sure if you've had time to look into it. |
|
reproduced. the @mafischer PR fix the problem. |
|
Trying this now with the latest version (2.3.1), the error is indeed gone, but looks like the Here is the test case, having set test('datetime is stored in correct timezone', async () => {
const author = new Author2('n', 'e');
author.born = new Date('2000-01-01T00:00:00Z');
await orm.em.persistAndFlush(author);
orm.em.clear();
const res = await orm.em.getConnection().execute<{ born: string }[]>(`select date_format(born, '%Y-%m-%d %T.%f') as born from author2 where id = ${author.id}`);
expect(res[0].born).toBe('2000-01-01 00:00:00.000000');
const a = await orm.em.findOneOrFail(Author2, author.id);
console.log('a.born', a.born);
console.log('author.born', author.born);
expect(+a.born!).toBe(+author.born); // <--- fails
});
console.log tests/EntityManager.mariadb.test.ts:70
a.born 1999-12-31T23:00:00.000Z
console.log tests/EntityManager.mariadb.test.ts:71
author.born 2000-01-01T00:00:00.000Z
Error: expect(received).toBe(expected) // Object.is equality
Expected: 946684800000
Received: 946681200000As I noted above, I tried to set different timezones, yet the results are always the same. Note that mariadb here is controlled via knex, so the issue might be also somewhere in the middle, but for mysql2 driver it works ok (and in MikroORM those drivers are pretty much identical, apart from the database connector used inside knex). edit: one thing I should add is that I am testing the mariadb connector with vanilla mysql database (official docker image). |
I am using the ORM mikro-orm and it has support to use
mariadbas connection driver. The author of the ORM has implemented a new feature to permit a DATETIME timezone forced. It work with all SQL drivers (mysql2,pgandsqlite3) but it has troubles withmariadb.The author of mikro-orm indicates the next: mikro-orm/mikro-orm#181 (comment)
Would it be possible to solve it?
The text was updated successfully, but these errors were encountered: