Skip to Content
Kenat is a work in progress project ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป
Documentation๐Ÿ–Œ๏ธ Formatting

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:

OptionTypeDefaultDescription
langstring'amharic'Language for month and weekday (amharic, english)
showWeekdaybooleanfalseWhether to include the weekday name
useGeezbooleanfalseFormat day and year with Geez numerals (Amharic only)
includeTimebooleanfalseInclude 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