[Maturing]

convert_jdate(date, legacy = getOption("zipangu.convert_jdate.legacy", TRUE))

Arguments

date

A character object.

legacy

A logical to switch converter. If TRUE (the default), use the legacy converter based on lubridate. If FALSE, use the 'ICU' implementation via stringi::stri_datetime_parse() with the ja-JP-u-ca-japanese locale. The default can also be controlled globally by options(zipangu.convert_jdate.legacy = FALSE).

Examples

convert_jdate("R3/2/27")
#> [1] "2021-02-27"
convert_jdate("\u4ee4\u548c2\u5e747\u67086\u65e5")
#> [1] "2020-07-06"

ICU implementation note

The non-legacy implementation depends on the system 'ICU' library through stringi. On some platforms (notably macOS with system 'ICU'), parsing with the ja-JP-u-ca-japanese locale can abort the R process. The legacy path is therefore used by default. See https://github.com/uribo/zipangu/issues/60.