Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentOutOfRangeException when calling TimeZoneService.SpecifyTimeZone #10

Open
calbot opened this issue Aug 10, 2017 · 0 comments
Open

Comments

@calbot
Copy link

calbot commented Aug 10, 2017

If I do something like this for "New Zealand Standard Time"

var tz = TimeZoneService.FindSystemTimeZoneById("New Zealand Standard Time");
var gregorian = DateTimeOffset.Now;
gregorian = TimeZoneService.SpecifyTimeZone(gregorian, var);

I get an exception ArgumentOutOfRangeException

{"Year, Month, and Day parameters describe an un-representable DateTime."}

   at System.DateTime.DateToTicks(Int32 year, Int32 month, Int32 day)
   at System.DateTime..ctor(Int32 year, Int32 month, Int32 day, Int32 hour, Int32 minute, Int32 second, Int32 millisecond, DateTimeKind kind)
   at TimeZones.Internal.TimeZoneInfoEx.FromSystemTime(SYSTEMTIME systemTime)
   at TimeZones.Internal.TimeZoneInfoEx.IsDaylightTime(DateTime date, TIME_ZONE_INFORMATION& tzi)
   at TimeZones.Internal.TimeZoneInfoEx.ConvertTime(DateTimeOffset dateTimeOffset)
   at TimeZones.TimeZoneService.TimeZoneEx.ConvertTime(DateTimeOffset dateTimeOffset)
   at TimeZones.TimeZoneService.SpecifyTimeZone(DateTimeOffset dateTimeOffset, ITimeZoneEx timeZone)

Running on Windows 10 as a Windows 8.1 app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant