MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

C# 有现成的System.DateTime.FromOADate方法问什么不用,是有什么特殊处理吗?

Open shaofing opened this issue 1 year ago • 3 comments

https://github.com/mini-software/MiniExcel/blob/f6992131ec09207e186345b3bced7e48f8e98407/src/MiniExcel/Utils/DateTimeHelper.cs#L63

C# 有现成的System.DateTime.FromOADate方法问什么不用,自己实现的是有什么特殊处理吗?

shaofing avatar May 11 '24 03:05 shaofing

@shaofing IsDateTimeFormat 还有 isDate1904 特别处理

shps951023 avatar May 12 '24 11:05 shps951023

看了DateTimeHelper.FromOADate的实现与System.DateTime.FromOADate(.Net4.5反编译)的实现逻辑一模一样,好像没有处理isDate1904相关

shaofing avatar May 16 '24 08:05 shaofing

@shaofing 👍我再确认下,假如没问题,预计下个版本移除 DateTimeHelper.FromOADate 或是能尝试PR? 这是你发现的 issue

shps951023 avatar Jun 10 '24 03:06 shps951023

@shps951023 If I understood this correctly there is a superfluous reimplementation of the Datetime.FromOADate function. I checked and when you expand the tick calculations they are perfectly identical. I can add the simplification to my next PR.

michelebastione avatar Mar 20 '25 17:03 michelebastione

@shps951023 If I understood this correctly there is a superfluous reimplementation of the Datetime.FromOADate function. I checked and when you expand the tick calculations they are perfectly identical. I can add the simplification to my next PR.

Please, thanks 🐱‍🏍

shps951023 avatar Mar 20 '25 23:03 shps951023