Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

japanese-date-converter

shoutatani754MIT2.0.0TypeScript support: included

Convert western or japanese years into opposite years.

jquery-plugin, japanese, date, era

readme

japanese-date-converter

npm version main

This module help you to convert Japanese date and Western years.

Demo Page

Installation

Using in ESModules

All you need is to call this in ESModule, please use like this.

// file top
import { JapaneseDateConverter } from "japanese-date-converter";

// in class or function
const inputValue = "R01/05/01";
const settings = {
  format: "yyyy/MM/dd"
};
const converter = new JapaneseDateConverter({ inputValue, settings });
const convertedValue = converter.execute();

Using in CommonJS

All you need is to call this in CommonJS, please use like this.

// file top
const { JapaneseDateConverter } = require('japanese-date-converter')

// in class or function
const inputValue = "R01/05/01";
const settings = {
  format: "yyyy/MM/dd"
};
const converter = new JapaneseDateConverter({ inputValue, settings });
const convertedValue = converter.execute();

Using in jQuery

Download script in dist folder, and include the script after the jQuery library (unless you are packaging scripts somehow else):

<script src="../dist/jquery.japanese-date-converter.js"></script>

And, call like this.

<script>
  $(document).ready(function () {
    $("#target").japanese_date_converter({ format: "yyyy/MM/dd" });
  });
</script>

Details

  1. When text inputted, the text will be converted as format.

  2. example

    • When format is "gee/MM/dd", "2019/04/30" will be "H31/04/30".
  3. If you'd like to know more, please check Demo Page.

  4. Supported format is as below.

    years
    style example date converted example
    ggg 2019/04/30 平成
    gg 2019/04/30
    g 2019/04/30 H
    yyyy 2019/04/30 2019
    yy 2019/04/30 19
    ee 1990/04/30 02
    e 1990/04/30 2
    months
    style example date converted example
    mmmmm 2019/04/30 A
    mmmm 2019/04/30 April
    mmm 2019/04/30 Apr
    MM 2019/04/30 04
    M 2019/04/30 4
    days
    style example date converted example
    dd 2019/04/02 02
    d 2019/04/02 2

Contributing

In preparation.

Authors

shoutatani

changelog

CHANGELOG

Features

Fixes

Chore & Maintenance

Performance

v2.0.0 (2022-05-08)

Fixes

  • [BREAKING] Stopped default export

Chore & Maintenance

  • Upgraded dependency packages

    • ts-jest
    • jest
    • ts-loader
    • typescript
  • Introduced lint script for execute format by prettier

  • Added tests to ensure that output can be used from CommonJS & ES Modules

v1.0.3 (2022-05-06)

Chore & Maintenance

  • Set compiled object version to ES5
  • Added webpack-merge for deviding webpack settings

v1.0.2 (2022-05-06)

Chore & Maintenance

  • Upgraded dependency packages
    • Bump minimist from 1.2.5 to 1.2.6

v1.0.1 (2022-05-06)

Chore & Maintenance

  • Upgraded webpack to latest version

v1.0.0 (2021-08-09)

Features

  • Enabled validation on invalid Wareki date (#10)

Fixes

  • [BREAKING] format option, mm and m was ended, and there are now MM and M.