Logo Lanfrica

mikiyasET/amharic-datepicker-utils

Domain:

natural language processing

Record type:

software
Creator:
mik
Host:
# Amharic Date Picker Utils Pure TypeScript utilities for Ethiopian (Amharic) calendar and time conversion. **Zero dependencies** — works on both backend and frontend, in any JavaScript runtime (Node.js, Deno, Bun, or browsers). > This is the logic-only companion to `amharic-datepicker`. If you need the React UI component, install `amharic-datepicker` instead (which depends on this package automatically). ## Installation ```bash # npm npm install amharic-datepicker-utils # yarn yarn add amharic-datepicker-utils # pnpm pnpm add amharic-datepicker-utils # bun bun add amharic-datepicker-utils ``` ## Quick Start ```javascript import { toEthiopian, toGregorian, toEthiopianTime, getEthTimePeriod, ethMonths } from 'amharic-datepicker-utils'; // Convert today's date to Ethiopian const now = new Date(); const ethDate = toEthiopian(now.getFullYear(), now.getMonth() + 1, now.getDate()); console.log(`${ethMonths[ethDate.month - 1]} ${ethDate.day}, ${ethDate.year}`); // e.g. "ግንቦት 26, 2018" // Convert the current time to Ethiopian const ethTime = toEthiopianTime(now.getHours(), now.getMinutes()); console.log(`${getEthTimePeriod(now.getHours())} ${ethTime.hour}:${String(ethTime.minute).padStart(2, '0')}`); // e.g. "ከሰዓት 3:56" // Convert Ethiopian date back to Gregorian const greg = toGregorian(ethDate.year, ethDate.month, ethDate.day); console.log(`${greg.year}-${greg.month}-${greg.day}`); // e.g. "2026-6-2" ``` ## Date Conversion Convert between Gregorian and Ethiopian calendars: ```typescript import { toEthiopian, toGregorian } from 'amharic-datepicker-utils'; // Gregorian → Ethiopian const ethDate = toEthiopian(2023, 9, 12); console.log(ethDate); // { year: 2016, month: 1, day: 1 } // Ethiopian → Gregorian const gregDate = toGregorian(2016, 1, 1); console.log(gregDate); // { year: 2023, month: 9, day: 12 } ``` ## Time Conversion Convert between the Ethiopian 12-hour clock and the Gregorian (standard) clock: ```typescript import { toEthiopianTime, toGregoria …

Languages