Logo Lanfrica

melos-simeneh/qenjs

Record type:

software
Creator:
mel
Host:
Ethiopian Date and Gregorian Date converter and formatter # QENJS: Ethiopian Date Handling Library QENJS is a library for working with Ethiopian Dates, providing convenient methods for creating, formatting, manipulating, and converting Ethiopian dates. This README will guide you through various examples and functionalities available in the QENJS library. Check out the live demo of the qenjs: Qenjs Demo ## Features - Convert between Ethiopian and Gregorian dates. - Format ethiopian dates in Amharic and latin. - Format gregorian dates - Calculate date difference and relative time ## Installation You can install qenjs via npm: ```bash npm install qenjs ``` Alternatively, if you're using Yarn: ```bash yarn add qenjs ``` ## Usage Here's how you can start using MiniDayjs in your project: ### 1. Create Ethiopian Date You can create an Ethiopian date using the following methods: ```javascript const ethiopianDate = qenjs(); console.log(ethiopianDate.toString()); // Outputs current ethiopian date const ethiopianDate2 = qenjs(2017, 1, 1); console.log(ethiopianDate2.toString()); // Outputs 01/01/2017 const ethiopianDate3 = qenjs("2017-01-29"); console.log(ethiopianDate3.format("DDDD, MMMM dd YYYY")); // Outputs: ረቡዕ, መስከረም 29 2017 const ethiopianDate4= qenjs({ year: 2017, month: 4, day: 15 }); console.log(ethiopianDate4.toString("DDDD, MMMM dd YYYY", "eng")); // Maksegno, Tahsas 15 2017 const ethiopianDate4= qenjs.fromGregorianDate(new Date()); console.log(ethiopianDate4.toString("DDDD, MMMM dd YYYY")); // Outputs current ethiopian date const ethiopianNightDate = qenjs("2017-01-29", { isNight: true }); console.log(ethiopianNightDate.toString("dd/MM/YYYY HH:mm:ss A")); // 29/01/2017 01:00:00 ምሽት ``` ### 2. Formatting Ethiopian Date You can format Ethiopian dates using custom patterns. The default language is Amharic, but you can specify another language if needed. ```javascript const ethiopianDate = qenjs({ year: 2017, month: 4, day: 15 }); console.log(ethiopianDate.format("MMMM dd, YYYY", "amh")); // ታኅሣሥ 15, 20 …