/** * Compares this date to another date, including the chronology. * <p> * Compares this {@code MinguoDate} with another ensuring that the date is the same. * <p> * Only objects of type {@code MinguoDate} are compared, other types return false. * To compare the dates of two {@code TemporalAccessor} instances, including dates * in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator. * * @param mixed $obj the object to check, null returns false * @return true if this is equal to the other date */ public function equals($obj) { if ($this === $obj) { return true; } if ($obj instanceof MinguoDate) { $otherDate = $obj; return $this->isoDate->equals($otherDate->isoDate); } return false; }
/** * Compares this date to another date, including the chronology. * <p> * Compares this {@code ThaiBuddhistDate} with another ensuring that the date is the same. * <p> * Only objects of type {@code ThaiBuddhistDate} are compared, other types return false. * To compare the dates of two {@code TemporalAccessor} instances, including dates * in two different chronologies, use {@link ChronoField#EPOCH_DAY} as a comparator. * * @param mixed $obj the object to check, null returns false * @return true if this is equal to the other date */ public function equals($obj) { if ($this === $obj) { return true; } if ($obj instanceof ThaiBuddhistDate) { return $this->isoDate->equals($obj->isoDate); } return false; }
/** * Checks if this date-time is equal to another date-time. * <p> * Compares this {@code LocalDateTime} with another ensuring that the date-time is the same. * Only objects of type {@code LocalDateTime} are compared, other types return false. * * @param mixed $obj the object to check, null returns false * @return true if this is equal to the other date-time */ public function equals($obj) { if ($this === $obj) { return true; } if ($obj instanceof LocalDateTime) { $other = $obj; return $this->date->equals($other->date) && $this->time->equals($other->time); } return false; }