UGregorian class
Gregorian date that converts exactly to/from Jalali. UGregorian(2024, 3, 20).toJalali()
Constructors
- UGregorian(int year, [int month = 1, int day = 1, int hour = 0, int minute = 0, int second = 0, int millisecond = 0])
-
Gregorian date from parts; throws RangeError for a day that does not exist.
factory
- UGregorian.fromDateTime(DateTime dt)
-
Gregorian date from a Dart DateTime.
factory
- UGregorian.fromJulianDayNumber(int jdn, [int hour = 0, int minute = 0, int second = 0, int millisecond = 0])
-
Gregorian date from a Julian day number.
factory
- UGregorian.now()
-
Today.
factory
Properties
- day → int
-
Day of the month.
final
- formatter → UGregorianFormatter
-
Text pieces for formatting.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- hour → int
-
Hour 0-23.
final
- julianDayNumber → int
-
Day number shared by every calendar (for converting and differences).
final
- millisecond → int
-
Millisecond 0-999.
final
- minute → int
-
Minute 0-59.
final
- month → int
-
Month 1-12.
final
- monthLength → int
-
Days in this month.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- second → int
-
Second 0-59.
final
- time → Duration
-
Time of day as a Duration.
no setterinherited
- weekDay → int
-
Weekday 1-7 (Jalali: 1 = Saturday).
no setteroverride
- year → int
-
Year.
final
Methods
-
add(
{int years = 0, int months = 0, int days = 0, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0}) → UGregorian -
Adds any amount; months clamp the day (31 + 1 month → 30), days and time overflow correctly.
j.add(months: 1, days: 3)override -
addDays(
int days) → UGregorian - Moves by whole days.
-
compareTo(
UDate other) → int -
Compares this object to another object.
inherited
-
copy(
{int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond}) → UGregorian -
Copy with some parts changed; throws RangeError when the day does not exist.
override
-
distanceTo(
UDate other) → int -
Days from this date to
other.inherited -
isLeapYear(
) → bool -
True in a leap year.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDateTime(
) → DateTime -
Local Dart DateTime.
override
-
toJalali(
) → UJalali - Same moment as UJalali.
-
toString(
) → String -
A string representation of this object.
override
-
toUtcDateTime(
) → DateTime -
UTC Dart DateTime.
override
Operators
-
operator +(
int days) → UGregorian -
override
-
operator -(
int days) → UGregorian -
override
-
operator <(
UDate other) → bool -
inherited
-
operator <=(
UDate other) → bool -
inherited
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator >(
UDate other) → bool -
inherited
-
operator >=(
UDate other) → bool -
inherited
Constants
- max → const UGregorian
- Latest supported date.
- min → const UGregorian
- Earliest supported date.