@@ -248,26 +248,26 @@ export class AstronomicalCalendar {
248
248
return this . getSunsetOffsetByDegrees ( AstronomicalCalendar . ASTRONOMICAL_ZENITH ) ;
249
249
}
250
250
251
- /**
252
- * A utility method that returns a date offset by the offset time passed in. Please note that the level of light
253
- * during twilight is not affected by elevation, so if this is being used to calculate an offset before sunrise or
254
- * after sunset with the intent of getting a rough "level of light" calculation, the sunrise or sunset time passed
255
- * to this method should be sea level sunrise and sunset.
256
- *
257
- * @param time
258
- * the start time
259
- * @param offset
260
- * the offset in milliseconds to add to the time.
261
- * @return the {@link java.util.Date} with the offset in milliseconds added to it
262
- */
263
- public static getTimeOffset ( time : DateTime | null , offset : number ) : DateTime | null {
264
- if ( time === null || offset === Long_MIN_VALUE || Number . isNaN ( offset ) ) {
265
- return null ;
266
- }
267
-
268
- return time . plus ( { milliseconds : offset } ) ;
251
+ /**
252
+ * A utility method that returns a date offset by the offset time passed in. Please note that the level of light
253
+ * during twilight is not affected by elevation, so if this is being used to calculate an offset before sunrise or
254
+ * after sunset with the intent of getting a rough "level of light" calculation, the sunrise or sunset time passed
255
+ * to this method should be sea level sunrise and sunset.
256
+ *
257
+ * @param time
258
+ * the start time
259
+ * @param offset
260
+ * the offset in milliseconds to add to the time.
261
+ * @return the {@link java.util.Date} with the offset in milliseconds added to it
262
+ */
263
+ public static getTimeOffset ( time : DateTime | null , offset : number ) : DateTime | null {
264
+ if ( time === null || offset === Long_MIN_VALUE || Number . isNaN ( offset ) ) {
265
+ return null ;
269
266
}
270
267
268
+ return time . plus ( { milliseconds : offset } ) ;
269
+ }
270
+
271
271
/**
272
272
* A utility method that returns the time of an offset by degrees below or above the horizon of
273
273
* {@link #getSunrise() sunrise}. Note that the degree offset is from the vertical, so for a calculation of 14°
@@ -444,7 +444,7 @@ export class AstronomicalCalendar {
444
444
* @see #getTemporalHour()
445
445
*/
446
446
public getTemporalHour ( startOfday : DateTime | null = this . getSeaLevelSunrise ( ) ,
447
- endOfDay : DateTime | null = this . getSeaLevelSunset ( ) ) : number {
447
+ endOfDay : DateTime | null = this . getSeaLevelSunset ( ) ) : number {
448
448
if ( startOfday === null || endOfDay === null ) {
449
449
return Long_MIN_VALUE ;
450
450
}
@@ -471,28 +471,28 @@ export class AstronomicalCalendar {
471
471
}
472
472
*/
473
473
474
- /**
475
- * A method that returns sundial or solar noon. It occurs when the Sun is <a href
476
- * ="http://en.wikipedia.org/wiki/Transit_%28astronomy%29">transiting</a> the <a
477
- * href="http://en.wikipedia.org/wiki/Meridian_%28astronomy%29">celestial meridian</a>. In this class it is
478
- * calculated as halfway between the sunrise and sunset passed to this method. This time can be slightly off the
479
- * real transit time due to changes in declination (the lengthening or shortening day).
480
- *
481
- * @param startOfDay
482
- * the start of day for calculating the sun's transit. This can be sea level sunrise, visual sunrise (or
483
- * any arbitrary start of day) passed to this method.
484
- * @param endOfDay
485
- * the end of day for calculating the sun's transit. This can be sea level sunset, visual sunset (or any
486
- * arbitrary end of day) passed to this method.
487
- *
488
- * @return the <code>Date</code> representing Sun's transit. If the calculation can't be computed such as in the
489
- * Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
490
- * not set, null will be returned. See detailed explanation on top of the page.
491
- */
492
- public getSunTransit ( startOfDay : DateTime | null = this . getSeaLevelSunrise ( ) , endOfDay : DateTime | null = this . getSeaLevelSunset ( ) ) : DateTime | null {
493
- const temporalHour : number = this . getTemporalHour ( startOfDay , endOfDay ) ;
494
- return AstronomicalCalendar . getTimeOffset ( startOfDay , temporalHour * 6 ) ;
495
- }
474
+ /**
475
+ * A method that returns sundial or solar noon. It occurs when the Sun is <a href
476
+ * ="http://en.wikipedia.org/wiki/Transit_%28astronomy%29">transiting</a> the <a
477
+ * href="http://en.wikipedia.org/wiki/Meridian_%28astronomy%29">celestial meridian</a>. In this class it is
478
+ * calculated as halfway between the sunrise and sunset passed to this method. This time can be slightly off the
479
+ * real transit time due to changes in declination (the lengthening or shortening day).
480
+ *
481
+ * @param startOfDay
482
+ * the start of day for calculating the sun's transit. This can be sea level sunrise, visual sunrise (or
483
+ * any arbitrary start of day) passed to this method.
484
+ * @param endOfDay
485
+ * the end of day for calculating the sun's transit. This can be sea level sunset, visual sunset (or any
486
+ * arbitrary end of day) passed to this method.
487
+ *
488
+ * @return the <code>Date</code> representing Sun's transit. If the calculation can't be computed such as in the
489
+ * Arctic Circle where there is at least one day a year where the sun does not rise, and one where it does
490
+ * not set, null will be returned. See detailed explanation on top of the page.
491
+ */
492
+ public getSunTransit ( startOfDay : DateTime | null = this . getSeaLevelSunrise ( ) , endOfDay : DateTime | null = this . getSeaLevelSunset ( ) ) : DateTime | null {
493
+ const temporalHour : number = this . getTemporalHour ( startOfDay , endOfDay ) ;
494
+ return AstronomicalCalendar . getTimeOffset ( startOfDay , temporalHour * 6 ) ;
495
+ }
496
496
497
497
/**
498
498
* A method that returns a <code>Date</code> from the time passed in as a parameter.
@@ -550,8 +550,8 @@ export class AstronomicalCalendar {
550
550
public getSunriseSolarDipFromOffset ( minutes : number ) : number | null {
551
551
if ( Number . isNaN ( minutes ) ) return null ;
552
552
553
- let offsetByDegrees : DateTime | null = this . getSeaLevelSunrise ( ) ;
554
- const offsetByTime : DateTime | null = AstronomicalCalendar . getTimeOffset ( this . getSeaLevelSunrise ( ) , - ( minutes * AstronomicalCalendar . MINUTE_MILLIS ) ) ;
553
+ let offsetByDegrees : DateTime | null = this . getSeaLevelSunrise ( ) ;
554
+ const offsetByTime : DateTime | null = AstronomicalCalendar . getTimeOffset ( this . getSeaLevelSunrise ( ) , - ( minutes * AstronomicalCalendar . MINUTE_MILLIS ) ) ;
555
555
556
556
let degrees : Big = new Big ( 0 ) ;
557
557
const incrementor : Big = new Big ( '0.0001' ) ;
@@ -577,8 +577,8 @@ export class AstronomicalCalendar {
577
577
public getSunsetSolarDipFromOffset ( minutes : number ) : number | null {
578
578
if ( Number . isNaN ( minutes ) ) return null ;
579
579
580
- let offsetByDegrees : DateTime | null = this . getSeaLevelSunset ( ) ;
581
- const offsetByTime : DateTime | null = AstronomicalCalendar . getTimeOffset ( this . getSeaLevelSunset ( ) , minutes * AstronomicalCalendar . MINUTE_MILLIS ) ;
580
+ let offsetByDegrees : DateTime | null = this . getSeaLevelSunset ( ) ;
581
+ const offsetByTime : DateTime | null = AstronomicalCalendar . getTimeOffset ( this . getSeaLevelSunset ( ) , minutes * AstronomicalCalendar . MINUTE_MILLIS ) ;
582
582
583
583
let degrees : Big = new Big ( 0 ) ;
584
584
const incrementor : Big = new Big ( '0.001' ) ;
0 commit comments