How to use the astronomia.julian 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 / test / chinese.mocha.js View on Github external
/* globals describe, it */
/* eslint no-multi-spaces: 0 */

'use strict'

process.env.TZ = 'Asia/Shanghai'

const assert = require('assert')
const julian = require('astronomia').julian

const CalendarChinese = require('../src').CalendarChinese

function toDate (jde) {
  return new julian.Calendar().fromJDE(jde).toDate()
}

describe('#CalendarChinese', function () {
  describe('construction', function () {
    let cal
    let exp = [78, 1, 10, true, 9]
    it('can construct via new', function () {
      cal = new CalendarChinese(78, 1, 10, true, 9)
      assert.ok(cal instanceof CalendarChinese)
      assert.deepEqual(cal.get(), exp)
    })
github commenthol / date-chinese / test / korean.mocha.js View on Github external
/* globals describe, it */
/* eslint no-multi-spaces: 0 */

'use strict'

const assert = require('assert')
const julian = require('astronomia').julian

const CalendarKorean = require('../src').CalendarKorean

// process.env.TZ = 'Asia/Seoul'

describe('#CalendarKorean', function () {
  describe('newYear', function () {
    var tests = [
      '1985-02-20T00:00:00+0900',
      '1986-02-09T00:00:00+0900'
    ]
    var cal = new CalendarKorean()
    tests.forEach(function (t) {
      var date = new Date(t)
      it(t, function () {
        var y = date.getFullYear()
github commenthol / date-chinese / test / japanese.mocha.js View on Github external
/* globals describe, it */
/* eslint no-multi-spaces: 0 */

'use strict'

const assert = require('assert')
const julian = require('astronomia').julian

const CalendarJapanese = require('../src').CalendarJapanese

process.env.TZ = 'Asia/Tokyo'

describe('#CalendarJapanese', function () {
  describe('newYear', function () {
    var tests = [
      '1887-01-24T00:00:56+0920',
      '1888-02-12T00:00:00+0900',
      '1986-02-09T00:00:00+0900'
    ]
    var cal = new CalendarJapanese()
    tests.forEach(function (t) {
      var date = new Date(t)
      it(t, function () {
github commenthol / date-chinese / test / vietnamese.mocha.js View on Github external
/* globals describe, it */
/* eslint no-multi-spaces: 0 */

'use strict'

const assert = require('assert')
const julian = require('astronomia').julian

const CalendarVietnamese = require('../src').CalendarVietnamese

// process.env.TZ = 'Asia/Ho_Chi_Minh'

describe('#CalendarVietnamese', function () {
  describe('newYear', function () {
    var tests = [
      '1967-02-09T00:00:00+0800',
      '1968-01-29T00:00:00+0700',
      '1985-01-21T00:00:00+0700', // this date is different to Chinese
      '1986-02-09T00:00:00+0700'
    ]
    var cal = new CalendarVietnamese()
    tests.forEach(function (t) {
      var date = new Date(t)