Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it(t, function () {
var y = date.getFullYear()
var jde = cal.newYear(y)
var res = new julian.CalendarGregorian().fromJDE(jde).toDate()
var td = new Date(t)
var err = Math.abs(+res - +td)
// test max error 2sec
assert.ok(err < 1000, res.toISOString() + ' !== ' + t)
})
})
it(y, function () {
let cal = new CalendarChinese()
let qm = cal.qingming(y)
cal.fromJDE(qm)
let gre = cal.toGregorian()
assert.deepEqual(gre, test[1])
// converting to Gregorian using jde
let gcal = new julian.CalendarGregorian().fromJDE(qm)
let ts = cal.timeshiftUTC(gcal)
let date = new Date(+(gcal.toDate()) + ts * 86400000)
assert.equal(date.toISOString(), test[2])
})
})
it(t, function () {
var y = date.getFullYear()
var jde = cal.newYear(y)
var res = new julian.CalendarGregorian().fromJDE(jde).toDate()
var td = new Date(t)
var err = Math.abs(+res - +td)
// test max error 2sec
assert.ok(err < 1000, res.toISOString() + ' !== ' + t)
})
})
it([year, test.sekki].join(' '), function () {
let jde = cal.solarTerm(test.sekki, year)
let res = new julian.CalendarGregorian().fromJDE(jde).toDate().toISOString()
assert.equal(res, new Date(test.exp).toISOString())
})
})