Package 'jcalendaR'

Title: Interconversion Between the Japanese Calendar System and the Western Calendar
Description: This is a set of simple utility functions to perform mutual conversion between the current Japanese calendar system that Wareki, the old Japanese calendar system that the Kyureki calendar and the Julian and Gregorian calendar. To calculate each calendar method, it converts to the Julian Day Number.
Authors: Mao Kobayashi [aut, cre]
Maintainer: Mao Kobayashi <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0.9000
Built: 2024-10-31 22:08:01 UTC
Source: https://github.com/indenkun/jcalendar

Help Index


jdn

Description

Functions for calculating Julian Date from Gregorian or Julian Date Number and functions for calculating Gregorian or Julian Date from Julian Date Number.

Usage

calendar2jdn(date, jdn = c("jdn", "mjd"), calendar = c("gregorian", "julian"))

jdn2calendar(
  n,
  jdn = c("jdn", "mjd"),
  calendar = c("gregorian", "julian"),
  sep = "/"
)

Arguments

date

Date to be converted. It should always include the year, month, and day.

jdn

Select Julius Date Number or Modified Julius Date Number.

calendar

Select whether the calendar is Gregorian or Julian.

n

Julian Date Number or Modified Julian Date Number value.

sep

The way the date is separated when the last date is written.

Value

* 'jdn2calendar' returns a string type date.

* 'calendar2jdn' returns a a numeric vector.

References

Julian Day Number - Wikipedia [ja] (JD, https://ja.wikipedia.org/wiki/%E3%83%A6%E3%83%AA%E3%82%A6%E3%82%B9%E9%80%9A%E6%97%A5)

Fliegel, H. F., Van Flandern, T. C. (1968), doi:10.1145/364096.364097, "A Machine Algorithm for Processing Calendar Dates", Communications of the ACM 11, p. 657.

Hatcher, D. A. (1984, BibCode:1984QJRAS..25...53H) "Simple formulae for Julian day numbers and calendar dates, Quarterly Journal of the Royal Astronomical Society", v. 25, p. 53-55, https://adsabs.harvard.edu/full/1984QJRAS..25...53H.

Meeus, J. (1998, ISBN:0943396638) "Astronomical Algorithms. Willmann-Bell", Second English Edition.

Examples

jdn2calendar(2459216)
calendar2jdn("2021/1/1")

jcalendaR-utils

Description

This is a set of utility functions related to the Kyureki calendar. 'number_kyureki.month()' checks how many days there were in a month by specifying the number of years and months in the Kyureki calendar. 'existence_leap.month()' checks if there was a leap month in a year by entering the number of years in the Kyureki calendar. 'era.name()' will output the era names of the corresponding year in this package.

Usage

number_kyureki.month(
  kyureki.year,
  kyureki.month,
  era = c("south", "north", "east", "heishi", "kyoto", "non")
)

existence_leap.month(
  kyureki.year,
  existence = c("logical", "number"),
  era = c("south", "north", "east", "heishi", "kyoto", "non")
)

era.name(era = c("south", "north", "east", "heishi", "kyoto"))

Arguments

kyureki.year

The number of years in the Kyureki calendar to check.

kyureki.month

The number of strings of months in the Kyureki calendar to check.

era

Whether the Gengo of the Japanese calendar is the Southern or Northern dynasty system, the system used in the Kanto region, the Heike, and Kyoto respectively, or no era names.

existence

Whether to return the existence of a leap month as a theoretical type or as a leap month number.

Value

* 'number_kyureki.month()' returns a numeric vector.

* 'existence_leap.month()' returns a numeric vector or logical vector.

* 'era.name()' returns a string vector that the era names of the corresponding year in this package.

References

The data for the Kyureki calendar and era names refer to the following data.

manakai/data-locale https://github.com/manakai/data-locale

Examples

existence_leap.month("\u660e\u6cbb2")
number_kyureki.month("\u660e\u6cbb2", 1)

kyureki

Description

This is a set of functions for mutual conversion between Kyureki that the lunar calendar and the calendar, the former calendar system of Japan. Kyureki the lunar calendar here is a calendar system that was never actually used, assuming that the Tenpo calendar was extended after the 6th year of Meiji.

Usage

seireki2kyureki(
  date,
  calendar = c("gregorian", "julian"),
  era = c("south", "north", "east", "heishi", "kyoto", "non"),
  one = c("kanji", "number"),
  leap.month = c("kanji", "hiragana"),
  sep = c("kanji", "/", "-")
)

kyureki2seireki(
  date,
  calendar = c("gregorian", "julian"),
  era = c("south", "north", "east", "heishi", "kyoto", "non"),
  sep = "/"
)

Arguments

date

Date to be converted. It should always include the year, month, and day.

calendar

Select whether the calendar is Gregorian or Julian.

era

Whether the Gengo of the Japanese calendar is the Southern or Northern dynasty system, the system used in the Kanto region, the Heike, and Kyoto respectively, or no era names.

one

Whether to write the year in kanji as the first year or leave it as a number.

leap.month

Whether to write leap months in Kanji or Hiragana.

sep

The way the date is separated when the last date is written.

Value

String type date.

References

The data for the Kyureki calendar and era names refer to the following data.

manakai/data-locale https://github.com/manakai/data-locale

Examples

seireki2kyureki("2021/1/1")
kyureki2seireki("\u4ee4\u548c3\u5e741\u67081\u65e5")

wareki

Description

This is a set of functions for mutual conversion from Wareki that Japanese calendar dates to the Julian or Gregorian calendar dates. Before 1872, the Japanese calendar was used as the lunar calendar.

Usage

seireki2wareki(
  date,
  calendar = c("gregorian", "julian"),
  era = c("south", "north", "east", "heishi", "kyoto", "non"),
  one = c("kanji", "number"),
  leap.month = c("kanji", "hiragana"),
  sep = c("kanji", "/", "-")
)

wareki2seireki(
  date,
  calendar = c("gregorian", "julian"),
  era = c("south", "north", "east", "heishi", "kyoto", "non"),
  sep = "/"
)

Arguments

date

Date to be converted. It should always include the year, month, and day.

calendar

Select whether the calendar is Gregorian or Julian.

era

Whether the Gengo of the Japanese calendar is the Southern or Northern dynasty system, the system used in the Kanto region, the Heike, and Kyoto respectively, or no era names.

one

Whether to write the year in kanji as the first year or leave it as a number.

leap.month

Whether to write leap months in Kanji or Hiragana.

sep

The way the date is separated when the last date is written.

Value

String type date.

References

The data for the Kyureki calendar and era names refer to the following data.

manakai/data-locale https://github.com/manakai/data-locale

Examples

wareki2seireki("\u4ee4\u548c3\u5e741\u67081\u65e5")
seireki2wareki("2021/1/1")
wareki2seireki("\u5929\u6b636\u5e743\u670813\u65e5", calendar = "julian")
seireki2wareki("1578/4/18")

wareki2kyureki

Description

A set of functions for mutual conversion between Kyureki that the old Japanese calendar and Wareki that the current Japanese calendar. For years before 1872, Kyureki and Wareki are identical. After 1873, the Gregorian calendar was adopted in Japan, and there is a difference from there.

Usage

wareki2kyureki(
  date,
  era = c("south", "north", "east", "heishi", "kyoto", "non"),
  one = c("kanji", "number"),
  leap.month = c("kanji", "hiragana"),
  sep = c("kanji", "/", "-")
)

kyureki2wareki(
  date,
  era = c("south", "north", "east", "heishi", "kyoto", "non"),
  one = c("kanji", "number"),
  leap.month = c("kanji", "hiragana"),
  sep = c("kanji", "/", "-")
)

Arguments

date

Date to be converted. It should always include the year, month, and day.

era

Whether the Gengo of the Japanese calendar is the Southern or Northern dynasty system, the system used in the Kanto region, the Heike, and Kyoto respectively, or no era names.

one

Whether to write the year in kanji as the first year or leave it as a number.

leap.month

Whether to write leap months in Kanji or Hiragana.

sep

The way the date is separated when the last date is written.

Value

String type date.

References

The data for the Kyureki calendar and era names refer to the following data.

manakai/data-locale https://github.com/manakai/data-locale

Examples

wareki2kyureki("\u4ee4\u548c3\u5e741\u67081\u65e5")
kyureki2wareki("\u4ee4\u548c2\u5e7411\u670818\u65e5")