From d1131db2a762c62b2611862b01010538d134dd3b Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Sat, 16 Dec 2023 22:48:25 +0530 Subject: [PATCH] docs: days diff + new days_diff util function --- frappe/utils/data.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index 0df5a32ef5..f3100cbbf5 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -291,6 +291,12 @@ def add_years(date: DateTimeLikeObject, years: NumericType) -> DateTimeLikeObjec def date_diff(string_ed_date, string_st_date): + """Returns the difference between given two dates in days.""" + return days_diff(string_ed_date, string_st_date) + + +def days_diff(string_ed_date, string_st_date): + """Returns the difference between given two dates in days.""" return (getdate(string_ed_date) - getdate(string_st_date)).days