-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add BaseUtcOffset to TimeZoneInfo.AdjustmentRule. #50256
Comments
Heh. Pretty much every timezone has an offset change from local solar noon to the first discrete offset. How are you anticipating these being represented? |
@Clockwork-Muse we just read the rules data from the OS. Whatever offsets giving there we'll use it. We just expose that data we read. |
namespace System
{
public partial class TimeZoneInfo
{
public partial class AdjustmentRule
{
public TimeSpan BaseUtcOffset { get; }
public static AdjustmentRule CreateAdjustmentRule(
DateTime dateStart,
DateTime dateEnd,
TimeSpan daylightDelta,
TransitionTime daylightTransitionStart,
TransitionTime daylightTransitionEnd,
TimeSpan baseUtcOffset
);
}
}
} |
Agree we need parameter on |
namespace System
{
public partial class TimeZoneInfo
{
public partial class AdjustmentRule
{
public TimeSpan BaseUtcOffsetDelta { get; }
// Existing method:
// public static AdjustmentRule CreateAdjustmentRule(
// DateTime dateStart,
// DateTime dateEnd,
// TimeSpan daylightDelta,
// TransitionTime daylightTransitionStart,
// TransitionTime daylightTransitionEnd
// );
public static AdjustmentRule CreateAdjustmentRule(
DateTime dateStart,
DateTime dateEnd,
TimeSpan daylightDelta,
TransitionTime daylightTransitionStart,
TransitionTime daylightTransitionEnd,
TimeSpan baseUtcOffsetDelta
);
}
}
} |
This proposal edited to address the feedback we got in the design review
Background and Motivation
TimeZoneInfo.Adjustment provides information about a time zone adjustment, such as the transition to and from daylight saving time. every adjustment rule has a start and end dates to describe at what date and time the rule can apply. Although the rule provides the information that help convert from the local time to UTC and vice versa, but it lacks an essential information which is what is the base UTC offset for the time zone during the rule period. TimeZoneInfo originally assumed that the base UTC offset for the zone is constant and never change which is incorrect. There are zones changed the UTC offset at some point.
The proposal here is have the AdjustmentRule class provide a property telling what the base UTC offset delta of the zone during the rule start and end date is.
Proposed API
Usage Examples
The text was updated successfully, but these errors were encountered: