Coder Social home page Coder Social logo

suncalc3's People

Contributors

brettz9 avatar fabiz avatar hypnos3 avatar jazzzz avatar mourner avatar mpetroff avatar nikolas avatar ryanp54 avatar tylershuster avatar victorthompson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

suncalc3's Issues

Incorrect getSunTimes data with negative coordinates

For example:
If do you use coordinates -7.16926 -35.34326

https://www.suncalc.org/#/-7.1693,-35.3433,6/2023.07.16/03:57/1/0

const date = new Date();

const lat = -7.1693;
const lng = -35.3433;

const times = SunCalc.getSunTimes(date.getUTCDate(), lat, lng);

console.log(times);

We get incorrect data:

{
  solarNoon: {
    value: 1970-01-01T14:26:16.258Z,
    ts: 51976258.009672165,
    name: 'solarNoon',
    julian: 2440588.1015770603,
    valid: true,
    pos: 10
  },
  nadir: {
    value: 1970-01-02T02:26:16.258Z,
    ts: 95176258.00967216,
    name: 'nadir',
    julian: 2440588.6015770603,
    valid: true,
    pos: 21
  },
  goldenHourDuskStart: {
    value: 1970-01-01T20:12:15.172Z,
    ts: 72735172.00648785,
    name: 'goldenHourDuskStart',
    elevation: 6,
    julian: 2440588.3418422686,
    valid: true,
    pos: 11
  },
  goldenHourDawnEnd: {
    value: 1970-01-01T08:40:17.344Z,
    ts: 31217344.012856483,
    name: 'goldenHourDawnEnd',
    elevation: 6,
    julian: 2440587.861311852,
    valid: true,
    pos: 9
  },
  sunsetStart: {
    value: 1970-01-01T20:39:48.319Z,
    ts: 74388319.94980574,
    name: 'sunsetStart',
    elevation: -0.3,
    julian: 2440588.3609759253,
    valid: true,
    pos: 12
  },
  sunriseEnd: {
    value: 1970-01-01T08:12:44.196Z,
    ts: 29564196.069538593,
    name: 'sunriseEnd',
    elevation: -0.3,
    julian: 2440587.8421781952,
    valid: true,
    pos: 8
  },
  sunsetEnd: {
    value: 1970-01-01T20:42:08.622Z,
    ts: 74528622.78968096,
    name: 'sunsetEnd',
    elevation: -0.833,
    julian: 2440588.362599801,
    valid: true,
    pos: 13
  },
  sunriseStart: {
    value: 1970-01-01T08:10:23.893Z,
    ts: 29423893.229663372,
    name: 'sunriseStart',
    elevation: -0.833,
    julian: 2440587.84055432,
    valid: true,
    pos: 7
  },
  goldenHourDuskEnd: {
    value: 1970-01-01T20:42:52.598Z,
    ts: 74572598.97440672,
    name: 'goldenHourDuskEnd',
    elevation: -1,
    julian: 2440588.3631087844,
    valid: true,
    pos: 14
  },
  goldenHourDawnStart: {
    value: 1970-01-01T08:09:39.917Z,
    ts: 29379917.04493761,
    name: 'goldenHourDawnStart',
    elevation: -1,
    julian: 2440587.840045336,
    valid: true,
    pos: 6
  },
  blueHourDuskStart: {
    value: 1970-01-01T20:56:04.029Z,
    ts: 75364029.64442968,
    name: 'blueHourDuskStart',
    elevation: -4,
    julian: 2440588.3722688616,
    valid: true,
    pos: 15
  },
  blueHourDawnEnd: {
    value: 1970-01-01T07:56:28.486Z,
    ts: 28588486.374914646,
    name: 'blueHourDawnEnd',
    elevation: -4,
    julian: 2440587.830885259,
    valid: true,
    pos: 5
  },
  civilDusk: {
    value: 1970-01-01T21:04:53.327Z,
    ts: 75893327.55804062,
    name: 'civilDusk',
    elevation: -6,
    julian: 2440588.378394995,
    valid: true,
    pos: 16
  },
  civilDawn: {
    value: 1970-01-01T07:47:39.188Z,
    ts: 28059188.46130371,
    name: 'civilDawn',
    elevation: -6,
    julian: 2440587.8247591257,
    valid: true,
    pos: 4
  },
  blueHourDuskEnd: {
    value: 1970-01-01T21:13:44.157Z,
    ts: 76424157.7103734,
    name: 'blueHourDuskEnd',
    elevation: -8,
    julian: 2440588.3845388624,
    valid: true,
    pos: 17
  },
  blueHourDawnStart: {
    value: 1970-01-01T07:38:48.358Z,
    ts: 27528358.30897093,
    name: 'blueHourDawnStart',
    elevation: -8,
    julian: 2440587.818615258,
    valid: true,
    pos: 3
  },
  nauticalDusk: {
    value: 1970-01-01T21:31:31.153Z,
    ts: 77491153.7334323,
    name: 'nauticalDusk',
    elevation: -12,
    julian: 2440588.3968883534,
    valid: true,
    pos: 18
  },
  nauticalDawn: {
    value: 1970-01-01T07:21:01.362Z,
    ts: 26461362.285912037,
    name: 'nauticalDawn',
    elevation: -12,
    julian: 2440587.806265767,
    valid: true,
    pos: 2
  },
  amateurDusk: {
    value: 1970-01-01T21:44:56.906Z,
    ts: 78296906.47423267,
    name: 'amateurDusk',
    elevation: -15,
    julian: 2440588.4062141953,
    valid: true,
    pos: 19
  },
  amateurDawn: {
    value: 1970-01-01T07:07:35.609Z,
    ts: 25655609.545111656,
    name: 'amateurDawn',
    elevation: -15,
    julian: 2440587.7969399253,
    valid: true,
    pos: 1
  },
  astronomicalDusk: {
    value: 1970-01-01T21:58:28.320Z,
    ts: 79108320.09762526,
    name: 'astronomicalDusk',
    elevation: -18,
    julian: 2440588.4156055567,
    valid: true,
    pos: 20
  },
  astronomicalDawn: {
    value: 1970-01-01T06:54:04.195Z,
    ts: 24844195.921719074,
    name: 'astronomicalDawn',
    elevation: -18,
    julian: 2440587.787548564,
    valid: true,
    pos: 0
  }
}

getSunTimes time results are slightly off

Hi,

Thanks for this library which is a great improvement. However I have one issue:

When I use this library for example solarNoon and I compare with timeanddate website or suncalc.org the times are ~1.5 off. Not only for solarNoon but also the rest?

Error in documentation getSolarTime

There is an error in the documentation which describes the interface SunCalc.getSolarTime(dateValue, utcOffset, lng).
This must be SunCalc.getSolarTime(dateValue, lng, utcOffset)

Moon Illumination phaseValue is not continuous

Problem

It appears that getMoonIllumination.phaseValue is not continuous.

As a test, I wrote a short program that prints out the phaseValue for each minute. Here you can see the phase value takes a big jump between 20:05 and 20:06. I would expect it to be a smooth transition from one minute to the next.

In terms of age, this about 3/4 of a day!

I hope I'm missing something.

--DH

Moon Phase Test Results

2023-01-06T20:01:00.000Z :: 0.4871753060126663
2023-01-06T20:02:00.000Z :: 0.4871768596219541
2023-01-06T20:03:00.000Z :: 0.4871783801686171
2023-01-06T20:04:00.000Z :: 0.4871798676416214
2023-01-06T20:05:00.000Z :: 0.4871813220302154
2023-01-06T20:06:00.000Z :: 0.5128172566761461
2023-01-06T20:07:00.000Z :: 0.5128158684877107
2023-01-06T20:08:00.000Z :: 0.5128145134145109
2023-01-06T20:09:00.000Z :: 0.5128131914662997
2023-01-06T20:10:00.000Z :: 0.5128119026517515

Steps to Reproduce

You can see my test program at: https://jsfiddle.net/jazztunes/6kaz81o7/

Different days for moonset and moonrise result

Hi! Thank you for a library.

I have met an issue using moonTimes. It returns the moonset and moonrise times for a different dates, when in this particular date there should not be a moonrise or a moonset.

You can try this input:

Tue Nov 21 2023 15:08:44 GMT+0300
LAT: 59.844404
LON: 30.3131

{
  rise: Tue Nov 21 2023 15:08:44 GMT+0300 (Moscow Standard Time),
  set: Wed Nov 22 2023 01:39:10 GMT+0300 (Moscow Standard Time)
}

You can see that the date is 21th, but the moonset should be NaN.

How to find the days of phase Moon

Hello, first I want to thank you for this very nice library!

For my question, I try to find the days of new moon, for example today: 28 November 2022 is β€œ5 days young Moon”.
Is there any idea how to get those days?

BTW: I wish to have moon eclipses, seems like is most of calculations already exist
astronomy.stackexchange.com/questions/231/what-is-the-formula-to-predict-lunar-and-solar-eclipses-accurately

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.