Closed DanAvni closed 6 years ago
why cant we convert the future dates same issue here
The range of intervals is expanded only so far. In general, the problem is that one cannot actually tell you what the local time is in the future because time zone rules are set by governments, and they can easily pass new legislation at any time. Indeed, this is why we have to keep time zone databases maintained.
In other words, the farther out you go, the less likely your prediction is accurate.
I totally agree that the result might not be accurate but if I ask to convert 1/1/2050 00:00 at UTC+12 to UTC some result is better than none in some cases. that is why I think the code should have a "Guess" parameter should no data exist for the time period (in which case the code would take the last known offset and use that)
Some time zones only have data for a few years in the future (e.g. 2023). When asking for a conversion of a date (local to utc) after that last date (e.g. 2060) the function returns null unlike NodaTime that returns a value (which might be inaccurate but is far better than null in some cases). I think the LocalToUtc should have an additional parameter to guess the offset for dates outside the data range