toDateTime method

DateTime toDateTime()

Returns the Gregorian DateTime for this date.

A date created from a DateTime (including PersianDate.now, PersianDate.fromGregorian, and PersianDate.fromGregorianString) returns that exact DateTime, with its time and time zone. A date created from Jalali values returns local midnight of that day.

Implementation

DateTime toDateTime() {
  final dateTime = _dateTime;
  if (dateTime != null) return dateTime;
  final g = d2g(j2d(year, month, day));
  return DateTime(g.gy, g.gm, g.gd);
}