'DateTime conversion failed with sequelise inserting a SQL Server record

When adding a new record into my database I get the error:

Conversion failed when converting date and/or time from character string

The datetime it tries to insert is:

2015-10-05 21:43:57.000 +00:00

It seems that Sequelise also inserts the timezone.

I tried setting the "timezone" to an empty string but this didn't help.

How can I insert a valid SQL Server DATETIME with sequelize?

Model:

    RegDate : {
       type : Tedious.TYPES.DateTime,
       defaultValue: Sequelize.NOW
    }


Solution 1:[1]

Change the Column data type in the DB from DateTime to DateTime2

-- This will fail
begin tran
CREATE TABLE #Temp1 ( CTECol datetime );
insert into #Temp1 select '2015-10-05 21:43:57.000 +00:00'
rollback

-- This will Success
begin tran
CREATE TABLE #Temp1 ( CTECol datetime2 );
insert into #Temp1 select '2015-10-05 21:43:57.000 +00:00'
rollback

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 OSAMA ORABI