Skip to content
GitHub

Modules

Dates

Write Gregorian dates in Malagasy and get the Malagasy names of months and weekdays, in five styles.

Result

Alahady 26 Jona 1960

JSformatDate('1960-06-26', 'full')PHPMalagasyDate::fromString('1960-06-26')->format(DateStyle::Full)
Open in the playground →
formatDate(date, style)Date → text in a DateStyle
getMonthName(month, width)1–12 → month name, wide or abbreviated
getWeekdayName(isoWeekday, width)ISO weekday 1–7 → name, wide or abbreviated
Style Output for 2026-11-23
long 23 Novambra 2026 (default)
full Alatsinainy 23 Novambra 2026
medium 2026 Nov 23
short 2026-11-23
numeric 23/11/2026
import { formatDate } from '@mdgascar/date';
formatDate('2026-11-23'); // '23 Novambra 2026'
formatDate('2026-11-23', 'full'); // 'Alatsinainy 23 Novambra 2026'
formatDate({ year: 1960, month: 6, day: 26 }, 'full'); // 'Alahady 26 Jona 1960'
formatDate(new Date(), 'numeric');

Weekdays use ISO numbers: Monday is 1, Sunday is 7.

import { getMonthName, getWeekdayName } from '@mdgascar/date';
getMonthName(6); // 'Jona'
getMonthName(6, 'abbreviated'); // 'Jon'
getWeekdayName(1); // 'Alatsinainy'
getWeekdayName(7, 'abbreviated'); // 'Alah'
Input Error code
A date that is not a string, Date or { year, month, day }; a month or weekday that is not a whole number INVALID_TYPE
Not a real calendar date (2026-02-30) INVALID_FORMAT
Month outside 1–12, weekday outside 1–7 OUT_OF_RANGE