Skip to content
GitHub

Guides

Which function do I need?

One table from what you want to do to the function to call, in TypeScript and PHP, with the Intl comparison.

You have You want TypeScript PHP
21 words: iraika amby roapolo spell(21) NumberWords::spell(21)
3 ordinal: fahatelo spellOrdinal(3) NumberWords::spellOrdinal(3)
1500 money: 1 500 Ar formatAriary(1500) $settings->format(Ariary::fromInt(1500))
0341234567 phone: 034 12 345 67 formatPhone(text, 'national') PhoneNumber::parse($text)->format(...)
2026-11-23 date: 23 Novambra 2026 formatDate('2026-11-23') MalagasyDate::fromString($text)->format()
14:30 time in words spellTime('14:30') MalagasyTime::fromString($text)->spell()
a date and a time both in words spellDateTime(text) MalagasyDateTime::fromString($text)->spell()
You have TypeScript Never throws
words such as iraika amby roapolo parseWords(text) tryParseWords
fahatelo parseOrdinal(text) tryParseOrdinal
Ar 1 500 parseAriary(text) tryParseAriary
034 12 345 67 parsePhone(text) tryParsePhone
23 Novambra 2026 parseDate(text) tryParseDate
a date and a time in words parseDateTime(text) tryParseDateTime

Each parse throws a MalagasyIntlError with a shared code, safeParse returns a result and tryParse returns undefined.

Need TypeScript
Group a phone number while the user types formatPhoneInput(text)
Group an amount while the user types formatAmountInput(text)
A message for the user, in English or French describeError(code, 'fr')
Every writer with your settings built in createMalagasy(settings)

Intl has no Malagasy number words, no Malagasy phone plan and no way to read text back. This library covers those, and follows CLDR for month names, weekday names and date patterns.

Task Intl malagasy-intl
Date in Malagasy Intl.DateTimeFormat('mg') formatDate(date)
Amount of money Intl.NumberFormat('mg', ...) formatAriary(amount)
Number in words not available spell(number)
Phone number not available formatPhone(text, format)
Read the text back not available parseDate, parseAriary…