MomentLocalization class abstract

Extend this class to create new localization





calendarData CalenderLocalizationData?
no setter
countryCode String?
Country code as defined in ISO 3166-1 alpha-2
no setter
defaultFormatters → FormatSetOptional
endonym String
Language name in the language itself
no setter
formatters → FormatSetOptional
no setter
hashCode int
The hash code for this object.
no setterinherited
languageCode String
Language code defined in ISO 639-1
no setter
languageNameInEnglish String
Language name in English
no setter
locale String
Locale ID
no setter
nonFinalFormatters Map<FormatterToken, FormatterTokenFn>
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tokens List<FormatterToken>
weekdayName Map<int, String>
Weekdays range from 1-7
no setter
weekStart int
Start of week. For example, Monday for most countries, Sunday for weird ones
no setter


calendar(Moment moment, {DateTime? reference, String? customFormat, bool omitHours = false, bool omitHoursIfDistant = true}) String
Calendar string
calendarTime(Moment moment) String
Some languages require article before the hours. For example, la 1:20, las 13:20 (Spanish)
duration(Duration duration, {bool round = true, bool omitZeros = true, bool includeWeeks = false, Abbreviation form = Abbreviation.none, String? delimiter, DurationFormat format =, bool dropPrefixOrSuffix = false}) String
This will return precise durations. For imprecise durations, use relative()
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
overrideFormatters() → FormatSetOptional
reformat(DateTime dateTime, String payload) String
relative(Duration duration, {bool dropPrefixOrSuffix = false, Abbreviation form = Abbreviation.none}) String
Toggle dropPrefixOrSuffix to get spanned duration without any prefix or suffix.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.

Static Methods

relativeThreshold(Duration duration) DurationInterval
Uses MomentLocalization._relativeThresholds map. Refer to this table for details:
startOfWeek(Moment refernce, [int startingWeekday = DateTime.monday]) Moment