CAP icon indicating copy to clipboard operation
CAP copied to clipboard

Add ability to use DateTimeOffset for Added and ExpiresAt Fields

Open KayakFisher205 opened this issue 3 years ago • 5 comments

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.

KayakFisher205 avatar May 28 '21 14:05 KayakFisher205

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 avatar Jun 01 '21 08:06 yang-xiaodong

@yang-xiaodong , do you store UTC time or something else? Is there any option available to override at Storage level?

maulik-modi avatar Jul 15 '21 11:07 maulik-modi

@KayakFisher205 if all datetime types are stored in UTC (and should be) then there is no necessary to change anything

dario-l avatar Nov 04 '21 09:11 dario-l

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 avatar Nov 04 '21 12:11 KayakFisher205

@KayakFisher205 I do not read the whole codebase but it should. 😃

dario-l avatar Nov 04 '21 12:11 dario-l