reminder-bot/dp.py

14 lines
371 B
Python
Raw Permalink Normal View History

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',
})
2020-09-26 21:23:41 +00:00
sys.stdout.write(str(int(dt.timestamp()) if dt is not None else -1))