How to use the astronomia/lib/julian.CalendarGregorian 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-chinese / lib / Chinese.js View on Github external
value: function fromJDE(jde) {
      var j = this.midnight(jde);
      var gc = new julian.CalendarGregorian().fromJDE(j);
      if (gc.month === 1 && gc.day < 20) gc.year--; // chinese new year never starts before 20/01
      this._from(j, gc.year);
      return this;
    }
github commenthol / date-chinese / src / Chinese.js View on Github external
fromJDE (jde) {
    const j = this.midnight(jde)
    const gc = new julian.CalendarGregorian().fromJDE(j)
    if (gc.month === 1 && gc.day < 20) gc.year-- // chinese new year never starts before 20/01
    this._from(j, gc.year)
    return this
  }
github commenthol / date-chinese / lib / Chinese.js View on Github external
value: function fromGregorian(year, month, day) {
      var j = this.midnight(new julian.CalendarGregorian(year, month, day).toJDE());
      if (month === 1 && day <= 20) year--; // chinese new year never starts before 20/01
      this._from(j, year);
      return this;
    }
github commenthol / date-chinese / src / Chinese.js View on Github external
function toYear (jde) {
  return new julian.CalendarGregorian().fromJDE(jde).toYear()
}
github commenthol / date-chinese / src / Chinese.js View on Github external
fromDate (date) {
    const j = this.midnight(new julian.CalendarGregorian().fromDate(date).toJDE())
    this._from(j, date.getFullYear())
    return this
  }
github commenthol / date-chinese / src / Chinese.js View on Github external
midnight (jde) {
    const gcal = new julian.CalendarGregorian().fromJDE(jde)
    const ts = 0.5 - this.timeshiftUTC(gcal)
    let mn = Math.trunc(gcal.toJD() - ts) + ts
    mn = gcal.fromJD(mn).toJDE()
    if (toFixed(jde, 5) === toFixed(mn, 5) + 1) {
      return jde
    }
    return mn
  }
github commenthol / date-chinese / lib / Chinese.js View on Github external
function toYear(jde) {
  return new julian.CalendarGregorian().fromJDE(jde).toYear();
}