Skip to Content
Kenat is a work in progress project ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป
Documentationโš™๏ธ Kenat Class

โš™๏ธ Kenat Class

The Kenat class provides a high-level API for working with Ethiopian calendar dates. You can create instances, format dates, manipulate them, and print calendars.


๐Ÿ— Constructor

new Kenat(dateString?)

Creates a new instance of an Ethiopian date.

  • If no argument is passed, it uses the current Gregorian system date.
  • If a string like '2015/6/10' is passed, itโ€™s parsed as an Ethiopian date.

undefined

const k = new Kenat(); const custom = new Kenat('2016/6/10');

๐Ÿ“† Date Access Methods

MethodReturnsDescription
getEthiopian(){ year, month, day }Current Ethiopian date
getGregorian(){ year, month, day }Equivalent Gregorian date
toString()"Ethiopian: yyyy-mm-dd"String format
format(lang?)"แˆ˜แˆตแŠจแˆจแˆ 5 2016" or similarHuman-readable string
formatInGeezAmharic()"แˆ˜แˆตแŠจแˆจแˆ แญ แณแปแฒแฎ"Geez-styled output

๐Ÿ•’ Time Handling

MethodDescription
getCurrentTime()Gets current time in Ethiopian format
setTime(hour, min, period)Sets Ethiopian time manually (e.g., 3:30 night)

โž• Date Arithmetic

MethodDescription
addDays(n)Move n days forward/backward
addMonths(n)Adjust by n Ethiopian months
addYears(n)Move by n Ethiopian years
const k = new Kenat('2014/5/5'); k.addDays(10); k.addMonths(-1); console.log(k.getEthiopian());

๐Ÿ“ Compare Dates

MethodDescription
diffInDays(other)Day difference
diffInMonths(other)Month difference
diffInYears(other)Year difference
const a = new Kenat('2015/6/10'); const b = new Kenat('2012/6/10'); console.log(a.diffInYears(b)); // โ†’ 3

๐Ÿ—“ Calendar Tools

MethodDescription
getMonthCalendar()Full info for every day in the current month
printThisMonth(useGeez?)Console grid printer for current month
const k = new Kenat('2016/1/1'); k.printThisMonth(true);
Last updated on