CAP
CAP copied to clipboard
Add ability to use DateTimeOffset for Added and ExpiresAt Fields
Since we have Daylight Savings Time in my location, we can be +6:00 hours part of the year then we switch to +5:00. When dates are stored as DateTime, at 2:00 AM on the date of the change, especially leaving DST, 2:00 am becomes 1:00 am. All of the transactions between 1:00 am and 1:59am of that day will get mixed with transactions of the next date from that next hour. So sorting is wrong.
If there was a option like: services.AddCap(x => { x.UseDateTimeOffset(); x.UseDashboard(); x.FailedRetryCount = 5; } The SQL code would create the new fields. I would be fine with extra fields like AddedWithOffset or an appropriated named field, so it would create an issue with having to handle normal DateTime for others who don't care. It would also give the change to use UTC too.
Hello,
Thank you for your feedback, as you said, this is a feature to be improved, we will consider to using DatetimeOffset.
PR is welcome, thanks
@yang-xiaodong , do you store UTC time or something else? Is there any option available to override at Storage level?
@KayakFisher205 if all datetime types are stored in UTC (and should be) then there is no necessary to change anything
That would be fine too, but I don't think that currently there is an option on how the datetime is stored. I believe the package controls it.
@KayakFisher205 I do not read the whole codebase but it should. 😃