other
) Returns true if other
is a DateTime at the same moment and in the
same time zone (UTC or local).
DateTime dDayUtc = new DateTime.utc(1944, DateTime.JUNE, 6);
DateTime dDayLocal = new DateTime(1944, DateTime.JUNE, 6);
assert(dDayUtc.isAtSameMomentAs(dDayLocal) == false);
See isAtSameMomentAs for a comparison that adjusts for time zone.
Source
/**
* Returns true if [other] is a [DateTime] at the same moment and in the
* same time zone (UTC or local).
*
* DateTime dDayUtc = new DateTime.utc(1944, DateTime.JUNE, 6);
* DateTime dDayLocal = new DateTime(1944, DateTime.JUNE, 6);
*
* assert(dDayUtc.isAtSameMomentAs(dDayLocal) == false);
*
* See [isAtSameMomentAs] for a comparison that adjusts for time zone.
*/
bool operator ==(other) {
if (!(other is DateTime)) return false;
return (millisecondsSinceEpoch == other.millisecondsSinceEpoch &&
isUtc == other.isUtc);
}