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

2.1.4 • Public • Published

Ethio-European Date Converter

convert date-time values between Ethiopian and European/Gregorian calendar.


build and test Version License FOSSA Status

Ethiopian calendar is unique for having 13 months, 12 months each with 30 days and 1 more month with 5 or 6 days. It is also 7/8 years behind the European/Gregorian calendar. This library contains javascript code (node/browser) for conversion of the date formats back and forth.

Install

Yarn

yarn add ethiopian-calendar-date-converter

npm

npm i -S ethiopian-calendar-date-converter

cdn

<script
  type="text/javascript"
  src="https://unpkg.com/ethiopian-calendar-date-converter@2"
></script>

Usage

import { EthDateTime, limits } from 'ethiopian-calendar-date-converter'

// Create a date instance from current date-time
const ethDateTime = EthDateTime.now()

// Convert to Ethiopian date
const ethDateTime = EthDateTime.fromEuropeanDate(dateInput)

// Convert from Ethiopian date
const ethDateTime = new EthDateTime(
  2012, // year (in Ethioian Calendar)
  2, // month of year (second month of year, in Ethioian Calendar)
  29, // day of month (in Ethioian Calendar)
  1, // hour (in Ethioian Time format)
  52, // minute (in Ethioian Time format)
  52, // second (in Ethioian Time format)
)
const date = ethDateTime.toEuropeanDate()

// get `limits` import to get minimum and maximum dat values that can be processed

Demo

A sample web application using this library can be accessed at https://ethiopian-calendar.netlify.app

License

This project is licensed under the MIT license.

Dependencies (0)

    Dev Dependencies (7)

    Package Sidebar

    Install

    npm i ethiopian-calendar-date-converter

    Weekly Downloads

    153

    Version

    2.1.4

    License

    MIT

    Unpacked Size

    174 kB

    Total Files

    26

    Last publish

    Collaborators

    • melaku