I would like to have a function get_cw_borders(year: int, cw: int) -> Tuple[datetime.datetime, datetime.datetime]
which should behave like this:
>>> get_cw_borders(2020, 17)
(datetime.datetime(2020, 4, 20), datetime.datetime(2020, 4, 26))
>>> get_cw_borders(2020, 18)
(datetime.datetime(2020, 4, 27), datetime.datetime(2020, 5, 3))
>>> get_cw_borders(2020, 1)
(datetime.datetime(2019, 12, 30), datetime.datetime(2020, 1, 5))
>>> get_cw_borders(2017, 1)
(datetime.datetime(2017, 1, 2), datetime.datetime(2017, 1, 8))
I'm aware that some countries start the week on Sunday instead of Monday. I think (please correct me if I'm wrong) that this is just a constant offset for this function, so that would not be a big deal.
Is there a built-in function to get this?
Non-Duplicates
Thank you for linking similar questions.
- Python: give start and end of week data from a given date: I don't have a given date