Skip to content

Bcl provider returns non-bcl zones #332

@GoogleCodeExporter

Description

@GoogleCodeExporter
I would expect something like this to work:

    var bcl = DateTimeZoneProviders.Bcl;
    var zones = bcl.Ids.Select(id => bcl[id])
                       .Cast<BclDateTimeZone>()
                       .Select(x => new {x.Id, x.DisplayName})
                       .ToList();

But it fails since the Bcl provider returns a few zones that are 
FixedDateTimeZone instead of BclDateTimeZone.   Specifically, they are "UTC", 
"UTC+12", "UTC-02", and "UTC-11".

While I understand that these zones *can* be represented as a fixed offset, 
shouldn't they still be delivered as a BclDateTimeZone since I used the Bcl 
provider?

Casting to a BclDateTimeZone is the only way to get at DisplayName, which is 
how I found this.  Other than calling TimeZoneInfo.FindSystemTimeZoneById, I 
can't think of another way to get back a display name such as "(UTC) 
Coordinated Universal Time" without hardcoding it.

Original issue reported on code.google.com by mj1856 on 26 Sep 2014 at 8:58

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions