Formatting Ethiopian Dates with Kenat
Kenat provides flexible methods to format Ethiopian dates and times with options for language, weekday names, Geez numerals, and time formatting.
format(options) Method
Formats the Ethiopian date with customizable options:
Option | Type | Default | Description |
---|---|---|---|
lang | string | 'amharic' | Language for month and weekday (amharic , english ) |
showWeekday | boolean | false | Whether to include the weekday name |
useGeez | boolean | false | Format day and year with Geez numerals (Amharic only) |
includeTime | boolean | false | Include Ethiopian time with localized suffix |
Examples
undefined
import Kenat from 'kenat';
const today = new Kenat(2016, 1, 10, 8, 30, 'day');
// Default: Amharic, no weekday, Arabic numerals, no time
console.log(today.format());
// Output: แแตแจแจแ 10 2016
// English month name
console.log(today.format({ lang: 'english' }));
// Output: Meskerem 10 2016
// Include weekday name in Amharic
console.log(today.format({ showWeekday: true }));
// Output: แแญแฐแ, แแตแจแจแ 10 2016
// Include weekday + Geez numerals in Amharic
console.log(today.format({ showWeekday: true, useGeez: true }));
// Output: แแญแฐแ, แแตแจแจแ แฒ แณแปแฒแฎ
// Include time, Amharic
console.log(today.format({ includeTime: true }));
// Output: แแตแจแจแ 10 2016 08:30 แ แแต
// Include weekday and time, English
console.log(today.format({ showWeekday: true, includeTime: true, lang: 'english' }));
// Output: Tuesday, Meskerem 10 2016 08:30 day
Additional Format Methods
format In Geez and Amharic
formatInGeezAmharic() Formats date with Amharic month and Geez numerals:
today.formatInGeezAmharic();
// Example output: แแตแจแจแ แฒ แณแปแฒแฎ
Format with Weekday
formatWithWeekday(lang = โamharicโ, useGeez = false)
Formats date with weekday name:
today.formatWithWeekday('english', false);
// Example output: Tuesday, Meskerem 10 2016
formatShort
formatShort() Returns a short date string:
today.formatShort();
// Example output: 2016/01/10
toISOString
toISOString() Returns ISO-like string with optional time:
today.toISOString();
// Example output: 2016-01-10T08:30
Last updated on