How to use the astronomia/lib/base.BesselianYear 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 / src / Chinese.js View on Github external
_from (j, year) {
    let ny = this.newYear(year)
    if (ny > j) {
      ny = this.newYear(year - 1)
    }
    let nm = this.previousNewMoon(j)
    if (nm < ny) {
      nm = ny
    }

    const years = 1.5 + (ny - this._epoch) / base.BesselianYear
    this.cycle = 1 + Math.trunc((years - 1) / 60)
    this.year = 1 + Math.trunc((years - 1) % 60)

    this.month = this.inMajorSolarTerm(nm).term
    const m = Math.round((nm - ny) / moonphase.meanLunarMonth)
    if (m === 0) {
      this.month = 1
      this.leap = false
    } else {
      this.leap = this.isLeapMonth(nm)
    }

    if (m > this.month) {
      this.month = m
    } else if (this.leap) {
      this.month--
github commenthol / date-chinese / lib / Chinese.js View on Github external
value: function _from(j, year) {
      var ny = this.newYear(year);
      if (ny > j) {
        ny = this.newYear(year - 1);
      }
      var nm = this.previousNewMoon(j);
      if (nm < ny) {
        nm = ny;
      }

      var years = 1.5 + (ny - this._epoch) / base.BesselianYear;
      this.cycle = 1 + Math.trunc((years - 1) / 60);
      this.year = 1 + Math.trunc((years - 1) % 60);

      this.month = this.inMajorSolarTerm(nm).term;
      var m = Math.round((nm - ny) / moonphase.meanLunarMonth);
      if (m === 0) {
        this.month = 1;
        this.leap = false;
      } else {
        this.leap = this.isLeapMonth(nm);
      }

      if (m > this.month) {
        this.month = m;
      } else if (this.leap) {
        this.month--;