Skip to content

Commit

Permalink
Merge pull request #40 from core-coin/update/worker-01
Browse files Browse the repository at this point in the history
Updated worker
  • Loading branch information
rastislavcore authored Feb 27, 2024
2 parents d1ea757 + 735e74e commit c6611ae
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions update_frontmatter.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import frontmatter
import os
from datetime import datetime, timedelta
from datetime import datetime, date

def parse_date(date_str):
formats = ['%Y-%m-%d', '%Y-%m-%dT%H:%M:%S.%fZ', '%Y-%m-%dT%H:%M:%SZ']
if isinstance(date_str, datetime):
return date_str
elif isinstance(date_str, date):
return datetime(date_str.year, date_str.month, date_str.day)

formats = ['%Y-%m-%d', '%Y-%m-%dT%H:%M:%S.%fZ', '%Y-%m-%dT%H:%M:%SZ', '%Y-%m-%dT%H:%M', '%Y-%m-%d %H:%M']
for fmt in formats:
try:
return datetime.strptime(date_str, fmt)
Expand Down

0 comments on commit c6611ae

Please sign in to comment.