@@ -41,11 +41,17 @@ Public get Variables
4141 ///Date of Solar Noon for
4242 public private( set) var solarNoon : Date = Date ( )
4343
44- ///Date at which evening Golden hour starts for instance timezone
44+ ///Date at which evening Afternoon Golden hour starts
4545 public private( set) var goldenHourStart : Date = Date ( )
46- ///Date at which evening Golden hour ends
46+ ///Date at which evening Afternoon Golden hour ends
4747 public private( set) var goldenHourEnd : Date = Date ( )
4848
49+ ///Date at which evening Morning Golden hour starts
50+ public private( set) var morningGoldenHourStart : Date = Date ( )
51+ ///Date at which evening Morning Golden hour ends
52+ public private( set) var morningGoldenHourEnd : Date = Date ( )
53+
54+
4955 ///Date at which there is the first light, also known as Civil Sunrise
5056 public private( set) var firstLight : Date = Date ( )
5157 ///Date at which there is the last light, also known as Civil Sunset
@@ -61,6 +67,27 @@ Public get Variables
6167 ///Date at which there is the Astronomical Sunset
6268 public private( set) var astronomicalSunset : Date = Date ( )
6369
70+ ///Date at which morning Blue Hour starts. Sun at -4 degrees elevation = morning golden hour start
71+ public var morningBlueHourStart : Date {
72+ return morningGoldenHourStart
73+ }
74+
75+ ///Date at which morning Blue Hour ends. Sun at -6 degrees elevation = first light
76+ public var morningBlueHourEnd : Date {
77+ return firstLight
78+ }
79+
80+ ///Date at which afternoon Blue Hour starts. Sun at -4 degrees elevation = afternoon golden hour end
81+ public var afternoonBlueHourStart : Date {
82+ return goldenHourEnd
83+ }
84+
85+ ///Date at which morning Blue Hour ends. Sun at -6 degrees elevation = last light
86+ public var afternoonBlueHourEnd : Date {
87+ return lastLight
88+ }
89+
90+
6491 /*--------------------------------------------------------------------
6592 Sun Azimuths for Self.date and for Sunrise,Sunset and Solar Noon
6693 *-------------------------------------------------------------------*/
@@ -272,14 +299,21 @@ Public methods
272299 print ( " Sunrise -> \( dateFormatter. string ( from: sunrise) ) " )
273300 print ( " Sunset -> \( dateFormatter. string ( from: sunset) ) " )
274301 print ( " Solar Noon -> \( dateFormatter. string ( from: solarNoon) ) " )
275- print ( " Golden Hour Start -> \( dateFormatter. string ( from: goldenHourStart) ) " )
276- print ( " Golden Hour End -> \( dateFormatter. string ( from: goldenHourEnd) ) " )
277- print ( " First Light -> \( dateFormatter. string ( from: firstLight) ) " )
302+ print ( " Afternoon Golden Hour Start -> \( dateFormatter. string ( from: goldenHourStart) ) " )
303+ print ( " Afternoon Golden Hour End -> \( dateFormatter. string ( from: goldenHourEnd) ) " )
304+ print ( " Morning Golden Hour Start -> \( dateFormatter. string ( from: morningGoldenHourStart) ) " )
305+ print ( " Morning Golden Hour End -> \( dateFormatter. string ( from: morningGoldenHourEnd) ) " )
306+ print ( " First Light -> \( dateFormatter. string ( from: firstLight) ) " )
278307 print ( " Last Light -> \( dateFormatter. string ( from: lastLight) ) " )
279308 print ( " Nautical Sunrise -> \( dateFormatter. string ( from: nauticalSunrise) ) " )
280309 print ( " Nautical Sunset -> \( dateFormatter. string ( from: nauticalSunset) ) " )
281310 print ( " Astronomical Sunrise -> \( dateFormatter. string ( from: astronomicalSunrise) ) " )
282311 print ( " Astronomical Sunset -> \( dateFormatter. string ( from: astronomicalSunset) ) " )
312+ print ( " Morning Blue Hour Start -> \( dateFormatter. string ( from: morningBlueHourStart) ) " )
313+ print ( " Morning Blue Hour End -> \( dateFormatter. string ( from: morningBlueHourEnd) ) " )
314+ print ( " Afternoon Blue Hour Start -> \( dateFormatter. string ( from: afternoonBlueHourStart) ) " )
315+ print ( " Afternoon Blue Hour End -> \( dateFormatter. string ( from: afternoonBlueHourEnd) ) " )
316+
283317 print ( " March Equinox -> \( dateFormatter. string ( from: marchEquinox) ) " )
284318 print ( " June Solstice -> \( dateFormatter. string ( from: juneSolstice) ) " )
285319 print ( " September Equinox -> \( dateFormatter. string ( from: septemberEquinox) ) " )
@@ -394,6 +428,8 @@ Private methods
394428 self . nauticalSunset = getNauticalSunset ( ) ?? Date ( )
395429 self . astronomicalSunrise = getAstronomicalSunrise ( ) ?? Date ( )
396430 self . astronomicalSunset = getAstronomicalSunset ( ) ?? Date ( )
431+ self . morningGoldenHourStart = getMorningGoldenHourStart ( ) ?? Date ( )
432+ self . morningGoldenHourEnd = getMorningGoldenHourEnd ( ) ?? Date ( )
397433
398434 }
399435
@@ -625,7 +661,7 @@ Private methods
625661 /// Golden Hour in the afternoon begins when the sun reaches elevation equals to 6 degrees
626662 /// - Returns: Time at which the GoldenHour starts
627663 private func getGoldenHourStart( ) -> Date ? {
628- guard let goldenHourStart = getDateFrom ( sunEvent: . goldenHourStart ) else {
664+ guard let goldenHourStart = getDateFrom ( sunEvent: . afternoonGoldenHourStart ) else {
629665 return nil
630666 }
631667
@@ -635,7 +671,7 @@ Private methods
635671 /// Golden Hour in the afternoon ends when the sun reaches elevation equals to -4 degrees
636672 /// - Returns: Time at which the GoldenHour ends
637673 private func getGoldenHourFinish( ) -> Date ? {
638- guard let goldenHourFinish = getDateFrom ( sunEvent: . goldenHourEnd ) else {
674+ guard let goldenHourFinish = getDateFrom ( sunEvent: . afternoonGoldenHourEnd ) else {
639675 return nil
640676 }
641677
@@ -696,6 +732,24 @@ Private methods
696732 return nauticalSunset
697733 }
698734
735+ /// Morning Golden Hour start when Sun reaches -4 degress of elevation
736+ /// - Returns: Morning golden hour start
737+ private func getMorningGoldenHourStart( ) -> Date ? {
738+ guard let morningGoldenHourStart = getDateFrom ( sunEvent: . morningGoldenHourStart , morning: true ) else {
739+ return nil
740+ }
741+ return morningGoldenHourStart
742+ }
743+
744+ /// Morning Golden Hour ends when Sun reaches 6 degress of elevation
745+ /// - Returns: Morning golden hour end
746+ private func getMorningGoldenHourEnd( ) -> Date ? {
747+ guard let morningGoldenHourEnd = getDateFrom ( sunEvent: . morningGoldenHourEnd , morning: true ) else {
748+ return nil
749+ }
750+ return morningGoldenHourEnd
751+ }
752+
699753
700754 /// Function only called when 'useSameTimeZone' equals TRUE. Needed for backward compatibility with old package versions.
701755 private func convertComponentsInCurrentTimeZoneDate( _ components: DateComponents ) -> Date ? {
0 commit comments