Developer forum

Forum » Integration » Change in date handling in OData provider

Change in date handling in OData provider

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

Previously, when I imported datetime minvalue from BC (0001/1/1) into DynamicWeb it would end up as 0001/1/1 in the database also (I am using datetime2 as the column type which should support this). After upgrading to Dynamicweb 9.16.4, these values now end up as 1753/1/1 which is the min value for datetime in SQL Server. That broke a couple of things in my solution in places that assumed 0001/1/1 as the value. I think it's from a code change on 10/18/2023  that adds this to ColumnMapping.cs

 private DateTime AdjustDateTime(DateTime dateTime)
        {
            DateTime theDateTime = dateTime;
            if (theDateTime < SqlDateTime.MinValue.Value)
            {
                theDateTime = SqlDateTime.MinValue.Value;
            }
            else if (theDateTime > SqlDateTime.MaxValue.Value)
            {
                theDateTime = SqlDateTime.MaxValue.Value;
            }
            return theDateTime;
        }

Should this code be updated to support datetime2 and return 0001/1/1 as the min value instead?

Imar


Replies

 
Matthias Sebastian Sort Dynamicweb Employee
Matthias Sebastian Sort
Reply

Hi Imar,

Sorry for the late answer.

We are very sorry about the troubles it has caused you by this update/change in DW.

We did discuss this in the integration-team, and saw that our standard integration had some troubles storing the datetimes into the database, as we kept receiving this error:

Therefor we made that change.

Hope you have fixed the issues :)

And Happy new year by the way! :D

BR

Matthias Sort

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Yes, understood. I think I was just hoping it would also support datetime2 which has a wider acceptable range including 1/1/0001

Happy new year to you too!

Imar

 

You must be logged in to post in the forum