import pendulum
def calc_expire_date(prodact_date, expiry):
prodact_date = pendulum.parse('{:0>2}-{:0>2}-{:0>2}'.format(*prodact_date))
target_date = pendulum.duration(**expiry) + prodact_date
days_to_expire = (target_date.date() - pendulum.now().date()).days
print(f'Product vaild until : {target_date} You have {days_to_expire} days')
calc_expire_date((2024, 11, 15), expiry = {'days': 15})
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter