feat(util): add is_last_day_of_the_month (#18835)
* feat: add is_last_day_of_the_month
This commit is contained in:
parent
a434b5fb0d
commit
bc0abd9cfd
2 changed files with 10 additions and 0 deletions
|
|
@ -493,6 +493,10 @@ class TestDateUtils(FrappeTestCase):
|
|||
frappe.utils.get_last_day_of_week("2020-12-28"), frappe.utils.getdate("2021-01-02")
|
||||
)
|
||||
|
||||
def test_is_last_day_of_the_month(self):
|
||||
self.assertEqual(frappe.utils.is_last_day_of_the_month("2020-12-24"), False)
|
||||
self.assertEqual(frappe.utils.is_last_day_of_the_month("2020-12-31"), True)
|
||||
|
||||
def test_get_time(self):
|
||||
datetime_input = now_datetime()
|
||||
timedelta_input = get_timedelta()
|
||||
|
|
|
|||
|
|
@ -471,6 +471,12 @@ def get_last_day(dt):
|
|||
return get_first_day(dt, 0, 1) + datetime.timedelta(-1)
|
||||
|
||||
|
||||
def is_last_day_of_the_month(dt):
|
||||
last_day_of_the_month = get_last_day(dt)
|
||||
|
||||
return getdate(dt) == getdate(last_day_of_the_month)
|
||||
|
||||
|
||||
def get_quarter_ending(date):
|
||||
date = getdate(date)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue