type property

DayType type

Define which sun events happens in the snapshot date

Implementation

DayType get type {
  final season = (location.isNorth) ? date.seasonNorth : date.seasonSouth;

  return switch ((sunrise, sunset)) {
    (null, null) when season == Season.winter || season == Season.autumn =>
      DayType.allNight,
    (null, null) => DayType.allDay,
    (null, _) => DayType.sunsetOnly,
    (_, null) => DayType.sunriseOnly,
    _ => DayType.sunriseAndSunset,
  };
}