http://bugzilla.novell.com/show_bug.cgi?id=583556

http://bugzilla.novell.com/show_bug.cgi?id=583556#c0


           Summary: Conversions between Utc and other timezones don't work
                    in DateTimeOffset
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: x86-64
        OS/Version: SLES 11
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: CORLIB
        AssignedTo: [email protected]
        ReportedBy: [email protected]
         QAContact: [email protected]
          Found By: ---
           Blocker: ---


Invoking the following code:
var utcNow = DateTimeOffset.UtcNow;
var tz = TimeZoneInfo.GetSystemTimeZones ().FirstOrDefault (o => o.Id ==
"Europe/Warsaw" || o.Id == "Central European Standard Time");
var cestOffset = tz.GetUtcOffset(utcNow);
var cestDate = utcNow.ToOffset(cestOffset);

This throws exception:
ArgumentException ("dateTime.Kind equals Utc and offset does not equal zero.")
On .NET the code works as expected. We currently use this workaround and it
seems to do the job:

var utcOffset = info.GetUtcOffset (time.UtcDateTime);
var newDate = time.UtcDateTime + utcOffset;
var cestDate = new DateTimeOffset(newDate.Ticks, utcOffset);

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to