Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @copyright 2016 commenthol
* @license MIT
*/
// import {base, solstice, solar, moonphase, planetposition, julian, data} from 'astronomia' // TODO waiting for tree-shaking that works...
import base from 'astronomia/lib/base'
import solstice from 'astronomia/lib/solstice'
import solar from 'astronomia/lib/solar'
import moonphase from 'astronomia/lib/moonphase'
import planetposition from 'astronomia/lib/planetposition'
import julian from 'astronomia/lib/julian'
import dataEarth from 'astronomia/data/vsop87Bearth'
const earth = new planetposition.Planet(dataEarth)
const lunarOffset = moonphase.meanLunarMonth / 2
const p = 180 / Math.PI
// Start of Chinese Calendar in 2636 BCE by Chalmers
const epochY = -2636
const epoch = new julian.CalendarGregorian(epochY, 2, 15).toJDE()
function toYear (jde) {
return new julian.CalendarGregorian().fromJDE(jde).toYear()
}
// prevent rounding errors
function toFixed (val, e) {
return parseFloat(val.toFixed(e), 10)
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @copyright 2016 commenthol
* @license MIT
*/
var base = require('astronomia/lib/base');
var solstice = require('astronomia/lib/solstice');
var solar = require('astronomia/lib/solar');
var moonphase = require('astronomia/lib/moonphase');
var planetpos = require('astronomia/lib/planetposition');
var julian = require('astronomia/lib/julian');
var earth = new planetpos.Planet(require('astronomia/data/vsop87Bearth.js'));
var lunarOffset = moonphase.meanLunarMonth / 2;
var p = 180 / Math.PI;
// Start of Chinese Calendar in 2636 BCE by Chalmers
var epochY = -2636;
var epoch = new julian.CalendarGregorian(epochY, 2, 15).toJDE();
function toYear(jde) {
return new julian.CalendarGregorian().fromJDE(jde).toYear();
}
// prevent rounding errors
function toFixed(val, e) {
return parseFloat(val.toFixed(e), 10);
}
'use strict'
const solstice = require('astronomia/lib/solstice')
const julian = require('astronomia/lib/julian')
const planetpos = require('astronomia/lib/planetposition')
const earth = new planetpos.Planet(require('astronomia/data/vsop87Bearth'))
const moment = require('moment-timezone')
const CalEvent = require('./CalEvent')
const CalDate = require('caldate')
class Equinox extends CalEvent {
/**
* @param {object} [opts]
* @param {string} opts.season - type of season (spring|summer|autumn|winter)
* @param {number|string} opts.offset - offset in days
*/
constructor (opts) {
opts = opts || {}
super(opts)
this._season = opts.season