Commit 40899c4b authored by Francesco Poldi's avatar Francesco Poldi

Fix output.datecheck

parent a522ebc5
...@@ -17,6 +17,12 @@ author_list.pop() ...@@ -17,6 +17,12 @@ author_list.pop()
# used by Pandas # used by Pandas
_follows_object = {} _follows_object = {}
def _formatDateTime(datetimestamp):
try:
return int(datetime.strptime(datetimestamp, "%Y-%m-%d %H:%M:%S").timestamp())
except ValueError:
return int(datetime.strptime(datetimestamp, "%Y-%m-%d").timestamp())
def _clean_follow_list(): def _clean_follow_list():
logme.debug(__name__+':clean_follow_list') logme.debug(__name__+':clean_follow_list')
global _follows_object global _follows_object
...@@ -35,14 +41,18 @@ def datecheck(datetimestamp, config): ...@@ -35,14 +41,18 @@ def datecheck(datetimestamp, config):
logme.debug(__name__+':datecheck') logme.debug(__name__+':datecheck')
if config.Since: if config.Since:
logme.debug(__name__+':datecheck:SinceTrue') logme.debug(__name__+':datecheck:SinceTrue')
d = int(datetime.strptime(datetimestamp, "%Y-%m-%d %H:%M:%S").timestamp())
s = int(datetime.strptime(config.Since, "%Y-%m-%d %H:%M:%S").timestamp()) d = _formatDateTime(datetimestamp)
s = _formatDateTime(config.Since)
if d < s: if d < s:
return False return False
if config.Until: if config.Until:
logme.debug(__name__+':datecheck:UntilTrue') logme.debug(__name__+':datecheck:UntilTrue')
d = int(datetime.strptime(datetimestamp, "%Y-%m-%d %H:%M:%S").timestamp())
s = int(datetime.strptime(config.Until, "%Y-%m-%d %H:%M:%S").timestamp()) d = _formatDateTime(datetimestamp)
s = _formatDateTime(config.Until)
if d > s: if d > s:
return False return False
logme.debug(__name__+':datecheck:dateRangeFalse') logme.debug(__name__+':datecheck:dateRangeFalse')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment