Skip to content
GitHub

Getting started

Changelog

What changed in each version of the spec, the behaviour every package implements.

Each entry is a spec version: the rules, data and test vectors every package implements. Package releases (npm, Packagist) follow it and list their own changes in their CHANGELOG.md. See Versioning for what each kind of number means.

Breaking marks an output that changes for an input that worked before.

  • ariary: New option grouping: 'none': no thousands separator. formatAriary(1500.5, { grouping: 'none' }) → Ar 1500,5; reading then accepts only digits and one decimal mark, so 1 500 is INVALID_FORMAT. The defaults do not change.
  • date-time: Breaking: spellTime and spellDateTime count every minute with minitra: 14:30 → amin'ny roa sy telopolo minitra tolakandro (was sy sasany), 17:45 → amin'ny dimy sy dimy amby efapolo minitra tolakandro (was enina latsaka fahefany hariva). Parts of the day: alina 0–3 and 20–23, maraina 4–11, atoandro 12, tolakandro 13–17, hariva 18–19. parseTime reads only this spelling.
  • Breaking: every package has a name that says what it does. No behaviour changes; functions, classes and methods keep their names.
Before Now
npm @mdgascar/utils @mdgascar/malagasy-intl
npm @mdgascar/words, @mdgascar/phone, @mdgascar/date @mdgascar/number-words, @mdgascar/phone-number, @mdgascar/date-time
Composer mdgascar/mdg-utils mdgascar/malagasy-intl
Composer mdgascar/mdg-utils-laravel mdgascar/malagasy-intl-laravel
Composer mdgascar/mdg-utils-bundle mdgascar/malagasy-intl-symfony
PHP Mdgascar\MdgUtils\Words, Phone, Date Mdgascar\MalagasyIntl\NumberWords, PhoneNumber, DateTime
MdgError, MdgUtilsException MalagasyIntlError, MalagasyIntlException
modules words, phone, date number-words, phone-number, date-time
  • Breaking: the error code AMBIGUOUS is gone. parseWords reads up to 15 digits before and after faingo and gives OUT_OF_RANGE above. parseDate without a style tries the styles in order: 5 Mey 12 is 5 May of year 12.
  • date: New spellDateTime writes the date, then the time in words: 2026-11-23T14:30 → 23 Novambra 2026 amin'ny roa sy sasany tolakandro.
  • date: New spellTime says the time of day in Malagasy: 14:30 → amin'ny roa sy sasany tolakandro. parseTime reads it back.
  • ariary: New option currencyDisplay: 'code': formatAriary(1500, { currencyDisplay: 'code' }) → MGA 1 500.
  • words: Breaking: a count before a group word is one phrase joined by amby (Wikipedia, dictionary). 201 000 000 → iraika amby roanjato tapitrisa (it shared iray sy roanjato tapitrisa with 200 000 001), 280 000 000 → valopolo amby roanjato tapitrisa. Numbers below 1000 keep sy from 200 (348 → valo amby efapolo sy telonjato, Peace Corps lessons).
  • words: New spellOrdinal: 3 → fahatelo, 4 → fahefatra, 1 → voalohany.
  • words: New parseWords, safeParseWords, tryParseWords: words back into the number. Phrases two numbers share (only from one million billion up) are AMBIGUOUS.
  • ariary: Breaking: nothing is rounded. Reading or converting an amount a number cannot hold is PRECISION_LOSS (was OUT_OF_RANGE, or a silently rounded value); { as: 'text' } gives the exact digits. Every function that takes an amount also takes decimal text. Reading takes up to 329 characters, so every formatted amount reads back.
  • ariary: 1,500 is 1.5 Ar: a recorded decision, no longer under review.
  • phone: Breaking: 036 (Yas) and fixed lines (020, 022) are valid instead of UNKNOWN_OPERATOR. A parsed number has type (mobile or fixed) and area, the town of a geographic number.
  • date: New parseDate, safeParseDate, tryParseDate: every style back into { year, month, day }.
  • New error codes PRECISION_LOSS and AMBIGUOUS.

Known bugs fixed in 0.9.0: two numbers with the same words (words), silent rounding when reading or converting (ariary), formatted amounts too long to read back (ariary), and 036 and fixed lines rejected (phone). Still open: a few phrases from one million billion up name two numbers (the reader answers AMBIGUOUS), and 5 Mey 12 reads as two dates because Mey is both the name and the abbreviation of May (parseDate answers AMBIGUOUS unless you pass the style). The full list is in the spec README.

  • Breaking: function names now use the domain’s words: spell (was numberToWords), spellAriary (ariaryToWords), parsePhone, safeParsePhone, tryParsePhone, isValidPhone, formatPhone (were …PhoneNumber), monthName (getMonthName), weekdayName (getWeekdayName). PHP: NumberWords::spell() takes an int, a float or text; ->spell() replaces ->toWords(). Outputs are unchanged.
  • words: Decimal text is read exactly: spell('1500.25') → dimanjato sy arivo faingo dimy amby roapolo. Text that is not plain decimal is INVALID_FORMAT; '12' reads roa ambin'ny folo instead of INVALID_TYPE.
  • words: In the traditional system, a number of 10¹⁹ or more (text only) is written in the standard system.
  • ariary: spellAriary takes the same decimal text.
  • words: New option system: 'traditional': one name per power of ten, each with a single digit. 30 000 000 → telo safatsiroa instead of telopolo tapitrisa. 10⁷–10¹⁵ come from Assimil, and 10¹⁶–10¹⁸ are derived from its faharoa rule. The standard system stays the default, and its output is unchanged.
  • ariary: ariaryToWords takes the same system option.
  • phone: New prefix 035 for Airtel Madagascar, on sale since 22 June 2026: 035 12 345 67 → operator airtel instead of UNKNOWN_OPERATOR.
  • phone: Breaking: Telma is now Yas Madagascar (since 26 November 2024). The operator id telma is now yas, named Yas Madagascar; PHP Operator::Telma is now Operator::Yas.
  • phone: 036, announced by Yas without a published source yet, stays UNKNOWN_OPERATOR and is listed under Waiting for a source.
  • words: Breaking: spells numbers of any size. lavitrisa takes a count of any size, so 10¹² is arivo lavitrisa instead of OUT_OF_RANGE. Each language stops at its largest exact number.
  • words: Decimals, read with faingo: 3.14 → telo faingo efatra ambin'ny folo. PHP adds NumberWords::fromFloat().
  • words: New section listing what waits for a source or an expert: negative numbers, and the old names for 10⁷ and above.
  • ariary: Breaking: no more 999 999 999 999 cap, and decimal amounts after a comma: Ar 1 500,5. PHP adds Ariary::fromFloat(); $amount is int|float.
  • ariary: Breaking: parseAriary('1,500') reads 1.5 instead of throwing INVALID_FORMAT. For English-style text, pass { grouping: 'comma', decimal: 'dot' }.
  • ariary: New grouping: comma and decimal options for formatting and the three parsers; the defaults stay Malagasy.
  • ariary: Breaking: FMG conversion is exact in decimal and accepts any francs: fmgToAriary(7501) → 1500.2 instead of OUT_OF_RANGE; ariaryToFmg(0.07) → 0.35.
  • ariary: Points under review: the default reading of 1,500, rounding of very long decimals, and formatted text longer than the 32-character reading limit.
  • words: Breaking: a count of one is bare only for arivo: 10 000 → iray alina, 1 000 000 → iray tapitrisa; 1 000 stays arivo.
  • words: Breaking: hundreds from 200 join with sy at every size (205 → dimy sy roanjato), and 11–19 use ambin'ny (11 → iraika ambin'ny folo).
  • spec: Breaking: modules moved to modules/ and schemas to schemas/. Adds the ariary and date modules.
  • spec: First spec: shared error codes and schemas, the words and phone modules.