MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / is_anniversary

Method is_anniversary

src/pendulum/date.py:166–177  ·  view source on GitHub ↗

Check if it's the anniversary. Compares the date/month values of the two dates.

(self, dt: date | None = None)

Source from the content-addressed store, hash-verified

164 return self == dt
165
166 def is_anniversary(self, dt: date | None = None) -> bool:
167 """
168 Check if it's the anniversary.
169
170 Compares the date/month values of the two dates.
171 """
172 if dt is None:
173 dt = self.__class__.today()
174
175 instance = self.__class__(dt.year, dt.month, dt.day)
176
177 return (self.month, self.day) == (instance.month, instance.day)
178
179 # the additional method for checking if today is the anniversary day
180 # the alias is provided to start using a new name and keep the backward

Callers 2

test_is_anniversaryFunction · 0.95
test_is_anniversaryFunction · 0.45

Calls 1

todayMethod · 0.45

Tested by 2

test_is_anniversaryFunction · 0.76
test_is_anniversaryFunction · 0.36