TimestampLocale class

Holds all user-facing strings used by DateTimeFormatting.

Override any field to localise or customise the output.

final myLocale = TimestampLocale(
  justNow: 'Baru saja',
  yesterday: 'Kemarin',
  unknownTime: 'Waktu tidak diketahui',
);
dateTime.toTimeagoFormat(locale: myLocale);

Constructors

TimestampLocale({String justNow = 'Just now', String minutesAgoSuffix = 'm ago', String hoursAgoSuffix = 'h ago', String yesterday = 'Yesterday', String unknownTime = 'Unknown time'})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
hoursAgoSuffix String
Suffix appended to hour count, e.g. "2h ago".
final
justNow String
Label returned when the difference is less than one minute.
final
minutesAgoSuffix String
Suffix appended to minute count, e.g. "3m ago".
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unknownTime String
Returned when DateTime is null.
final
yesterday String
Label used for the previous calendar day.
final

Methods

hoursAgo(int hours) String
Builds the "Xh ago" string. Override by subclassing if you need different grammar (e.g. "vor 2 Std.").
minutesAgo(int minutes) String
Builds the "Xm ago" string. Override by subclassing if you need different grammar (e.g. "vor 3 Min.").
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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