MCPcopy Create free account
hub / github.com/adobe/Marinus / monthdelta

Function monthdelta

python3_cron_scripts/remove_expired_entries.py:47–71  ·  view source on GitHub ↗

Get the date relevant to the delta from today's date

(date, delta)

Source from the content-addressed store, hash-verified

45
46
47def monthdelta(date, delta):
48 """
49 Get the date relevant to the delta from today's date
50 """
51 m, y = (date.month + delta) % 12, date.year + ((date.month) + delta - 1) // 12
52 if not m:
53 m = 12
54 d = min(
55 date.day,
56 [
57 31,
58 29 if y % 4 == 0 and not y % 400 == 0 else 28,
59 31,
60 30,
61 31,
62 30,
63 31,
64 31,
65 30,
66 31,
67 30,
68 31,
69 ][m - 1],
70 )
71 return date.replace(day=d, month=m, year=y)
72
73
74def get_int_for_unk_type(dtype):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected