@hebcal/noaa 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -42,9 +42,6 @@ class GeoLocation {
42
42
  * The elevation to set in Meters. An IllegalArgumentException will be thrown if the value is a negative.
43
43
  */
44
44
  setElevation(elevation) {
45
- if (elevation < 0) {
46
- throw new Error('Elevation cannot be negative');
47
- }
48
45
  this.elevation = elevation;
49
46
  }
50
47
  constructor(name = 'Greenwich, England', latitude = 51.4772, longitude = 0, elevationOrTimeZoneId, timeZoneId) {
@@ -570,7 +567,8 @@ class NOAACalculator {
570
567
  if (startOfday === null || endOfDay === null) {
571
568
  return Long_MIN_VALUE;
572
569
  }
573
- return (endOfDay.valueOf() - startOfday.valueOf()) / 12;
570
+ const delta = endOfDay.epochMilliseconds - startOfday.epochMilliseconds;
571
+ return Math.floor(delta / 12);
574
572
  }
575
573
  /**
576
574
  * A method that returns sundial or solar noon. It occurs when the Sun is <a href
package/dist/esm/index.js CHANGED
@@ -39,9 +39,6 @@ export class GeoLocation {
39
39
  * The elevation to set in Meters. An IllegalArgumentException will be thrown if the value is a negative.
40
40
  */
41
41
  setElevation(elevation) {
42
- if (elevation < 0) {
43
- throw new Error('Elevation cannot be negative');
44
- }
45
42
  this.elevation = elevation;
46
43
  }
47
44
  constructor(name = 'Greenwich, England', latitude = 51.4772, longitude = 0, elevationOrTimeZoneId, timeZoneId) {
@@ -566,7 +563,8 @@ export class NOAACalculator {
566
563
  if (startOfday === null || endOfDay === null) {
567
564
  return Long_MIN_VALUE;
568
565
  }
569
- return (endOfDay.valueOf() - startOfday.valueOf()) / 12;
566
+ const delta = endOfDay.epochMilliseconds - startOfday.epochMilliseconds;
567
+ return Math.floor(delta / 12);
570
568
  }
571
569
  /**
572
570
  * A method that returns sundial or solar noon. It occurs when the Sun is <a href
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/noaa",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "sunrise and sunset via NOAA algorithm with elevation, based on KosherJava",
5
5
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
6
6
  "contributors": [
@@ -40,9 +40,9 @@
40
40
  "dist/*"
41
41
  ],
42
42
  "devDependencies": {
43
- "@types/node": "20.8.2",
43
+ "@types/node": "20.9.2",
44
44
  "gts": "^5.2.0",
45
- "typescript": "^5.2.2"
45
+ "typescript": "^5.3.2"
46
46
  },
47
47
  "dependencies": {
48
48
  "temporal-polyfill": "^0.1.1"