IsDaylightSavingTime method
Gets a value indicating whether the local wall-clock time is in daylight saving time.
Implementation
bool IsDaylightSavingTime(DateTime wallClock) {
if (!SupportsDaylight) {
return false;
}
final start = DaylightTransitionStart!.GetOccurrence(wallClock.year);
final end = DaylightTransitionEnd!.GetOccurrence(wallClock.year);
if (start.isBefore(end)) {
return !wallClock.isBefore(start) && wallClock.isBefore(end);
} else {
// Southern hemisphere: daylight saving time spans the turn of the year.
return !wallClock.isBefore(start) || wallClock.isBefore(end);
}
}