How to use the astronomia/lib/julian.Calendar function in astronomia

To help you get started, we’ve selected a few astronomia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commenthol / date-holidays-parser / src / Equinox.js View on Github external
}
      case 'june': {
        jde = solstice.june2(year, earth)
        break
      }
      case 'september': {
        jde = solstice.september2(year, earth)
        break
      }
      case 'december': {
        jde = solstice.december2(year, earth)
        break
      }
    }

    const str = new julian.Calendar().fromJDE(jde).toDate().toISOString()
    let date
    if (/^[+-]\d{2}:\d{2}?$/.test(this._timezone)) { // for '+08:00' formats
      date = moment(str).utcOffset(this._timezone)
    } else { // for 'Asia/Shanghai' formats
      date = moment(str).tz(this._timezone) // move to timezone
    }

    const floorDate = {
      year: year,
      month: date.month() + 1,
      day: date.date()
    }

    const d = new CalDate(floorDate).setOffset(this.offset)
    this.dates.push(d)
    return this