reminder-bot/dp.py
2020-09-26 22:23:41 +01:00

14 lines
371 B
Python

import dateparser
import sys
import pytz
from datetime import datetime
dt = dateparser.parse(sys.argv[1], settings={
'TIMEZONE': sys.argv[2],
'TO_TIMEZONE': sys.argv[3],
'RELATIVE_BASE': datetime.now(pytz.timezone(sys.argv[2])).replace(tzinfo=None),
'PREFER_DATES_FROM': 'future',
})
sys.stdout.write(str(int(dt.timestamp()) if dt is not None else -1))