Tempus class
Constructors
- Tempus()
- Default Tempus constructor. Creates a new Tempus instance based on current time in the local time zone.
- Tempus.fromDate(DateTime date)
- Creates a new Tempus with the specified date. [...]
Properties
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
date(
) → DateTime -
Returns the inner
DateTime
. -
format(
[IFormat format ]) → IFormat - Simultaneous getter and setter for this instance's format. [...]
-
from(
Tempus other, [ bool withoutPrefixOrSuffix = false ]) → String -
Returns a
String
with the different between this andother
. Takes an optionalbool
argument to decide whether to use an identifier.withoutPrefixOrSuffix
defaults tofalse
. [...] -
fromNow(
[bool withoutPrefixOrSuffix = false ]) → String -
Returns a
String
with the different between this and Tempus(). Takes an optionalbool
argument to decide whether to use an identifier.withoutPrefixOrSuffix
defaults tofalse
. [...] -
locale(
[ILocale locale ]) → ILocale - Simultaneous getter and setter for this instance's locale. [...]
-
toString(
) → String -
Retuns a human-readable
String
for this instance. [...]override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Properties
- apiDayFormat → String
-
Returns the global
_apiDayFormat
read-only - dayFormat → String
-
Returns the global
_dayFormat
read-only - dayOfMonthFormat → String
-
Returns the global
_dayOfMonthFormat
read-only - dayOfWeekFormat → String
-
Returns the global
_dayOfWeekFormat
read-only - monthFormat → String
-
Returns the global
_monthFormat
read-only - weekDayFormat → String
-
Returns the global
_weekDayFormat
read-only
Static Methods
-
datesInMonthGrid(
DateTime month, [ bool sixBySeven = false bool startOnMonday = false ]) → List< DateTime> -
Returns a grid-like list of
DateTime
s in a given month, with either 35 or 42 items. [...] -
datesInRange(
DateTime start DateTime end) → Iterable< DateTime> -
Returns a
DateTime
for each day the given range. [...] -
firstDayOfMonth(
DateTime month) → DateTime -
Returns a new
DateTime
in the 1st day of the given month -
firstDayOfWeek(
DateTime day, [ bool startOnMonday = false ]) → DateTime -
Returns a new
DateTime
on Monday of the current week. -
formatApiDay(
DateTime d) → String - Returns a formatted string in the Tempus.apiDayFormat format
-
formatDay(
DateTime d) → String - Returns a formatted string in the Tempus.dayFormat format
-
formatDayOfMonth(
DateTime d) → String - Returns a formatted string in the Tempus.dayOfMonthFormat format
-
formatDayOfWeek(
DateTime d) → String - Returns a formatted string in the Tempus.dayOfWeekFormat format
-
formatMonth(
DateTime d) → String - Returns a formatted string in the Tempus.monthFormat format
-
formatWeekDay(
DateTime d) → String - Returns a formatted string in the Tempus.weekDayFormat format
-
globalFormat(
[IFormat format ]) → IFormat - Simultaneous getter and setter for the global format. [...]
-
globalLocale(
[ILocale locale ]) → ILocale - Simultaneous getter and setter for the global locale. [...]
-
isFirstDayOfMonth(
DateTime day) → bool - Whether or not the given date is the first day of a month
-
isLastDayOfMonth(
DateTime day) → bool - Whether or not the given date is the last day of a month
-
isSameDay(
DateTime a DateTime b) → bool - Whether or not two dates are on the same day.
-
isSameWeek(
DateTime a DateTime b) → bool - Whether or not two dates are in the same week
-
lastDayOfMonth(
DateTime month) → DateTime -
Returns a new
DateTime
in the last day of the given month -
lastDayOfWeek(
DateTime day, [ bool endOnSunday = false ]) → DateTime -
Returns a new
DateTime
on Saturday of the current week. -
nextMonth(
DateTime m) → DateTime -
Retuns a new
DateTime
in the next calendar month. [...] -
nextWeek(
DateTime w) → DateTime -
Returns a new
DateTime
7 days after the given date -
parse(
String date) → Tempus - Constructs a new Tempus instance based on formatted date strings. [...]
-
previousMonth(
DateTime m) → DateTime -
Retuns a new
DateTime
in the previous calendar month. [...] -
previousWeek(
DateTime w) → DateTime -
Returns a new
DateTime
7 days before the given date -
setApiDayFormat(
String format) → void -
Sets the global
_apiDayFormat
-
setDayFormat(
String format) → void -
Sets the global
_dayFormat
-
setDayOfMonthFormat(
String format) → void -
Sets the global
_dayOfMonthFormat
-
setDayOfWeekFormat(
String format) → void -
Sets the global
_dayOfWeekFormat
-
setMonthFormat(
String format) → void -
Sets the global
_monthFormat
-
setWeekDayFormat(
String format) → void -
Sets the global
_weekDayFormat