From 2b85f4996c002b9cccfda412fe0a32fd5874f14a Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 11 Jun 2019 21:25:32 +0530 Subject: [PATCH] feat: Add get_first_day_of_week utillity method --- frappe/utils/data.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index a6c2c4f135..77b03ac181 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -182,6 +182,9 @@ def get_first_day(dt, d_years=0, d_months=0): return datetime.date(year, month + 1, 1) +def get_first_day_of_week(dt): + return dt - datetime.timedelta(days=dt.weekday()) + def get_last_day(dt): """ Returns last day of the month using: