japanese-date-converter
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0 • Public • Published

    japanese-date-converter

    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').default
    
    // 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.
    • example
      • When format is "gee/MM/dd", "2019/04/30" will be "H31/04/30".
    • If you'd like to know more, please check Demo Page.
    1. 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

    Install

    npm i japanese-date-converter

    DownloadsWeekly Downloads

    40

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    48.9 kB

    Total Files

    23

    Last publish

    Collaborators

    • shoutatani