Method: Date#===
- Defined in:
- date_core.c
#===(other) ⇒ Boolean
Returns true if they are the same day.
Date.new(2001,2,3) === Date.new(2001,2,3)
#=> true
Date.new(2001,2,3) === Date.new(2001,2,4)
#=> false
DateTime.new(2001,2,3) === DateTime.new(2001,2,3,12)
#=> true
DateTime.new(2001,2,3) === DateTime.new(2001,2,3,0,0,0,'+24:00')
#=> true
DateTime.new(2001,2,3) === DateTime.new(2001,2,4,0,0,0,'+24:00')
#=> false
6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 |
# File 'date_core.c', line 6325
static VALUE
d_lite_equal(VALUE self, VALUE other)
{
if (!k_date_p(other))
return equal_gen(self, other);
{
get_d2(self, other);
if (!(m_gregorian_p(adat) == m_gregorian_p(bdat)))
return equal_gen(self, other);
{
VALUE a_nth, b_nth;
int a_jd, b_jd;
m_canonicalize_jd(adat);
m_canonicalize_jd(bdat);
a_nth = m_nth(adat);
b_nth = m_nth(bdat);
a_jd = m_local_jd(adat);
b_jd = m_local_jd(bdat);
if (f_eqeq_p(a_nth, b_nth) &&
a_jd == b_jd)
return Qtrue;
return Qfalse;
}
}
}
|