mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Work on main Schedule, support for holidays
This commit is contained in:
parent
49870d23eb
commit
ee3ee5284d
3 changed files with 145 additions and 3 deletions
|
|
@ -1,8 +1,12 @@
|
|||
import datetime
|
||||
from typing import List
|
||||
|
||||
import dateutil.relativedelta
|
||||
import pytz
|
||||
import time
|
||||
|
||||
from functions import stringFormatters
|
||||
|
||||
|
||||
def epochToDate(epochTimeStamp, strFormat="%d/%m/%Y om %H:%M:%S"):
|
||||
now = dateTimeNow()
|
||||
|
|
@ -147,8 +151,16 @@ def intToWeekday(day):
|
|||
return ["Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrijdag", "Zaterdag", "Zondag"][day]
|
||||
|
||||
|
||||
def fromString(timeString: str, formatString="%d/%m/%Y"):
|
||||
def fromString(timeString: str, formatString="%d/%m/%Y", tzinfo=pytz.timezone("Europe/Brussels")):
|
||||
"""
|
||||
Constructs a datetime object from an input string
|
||||
"""
|
||||
return datetime.datetime.strptime(timeString, formatString)
|
||||
return datetime.datetime.strptime(timeString, formatString).replace(tzinfo=tzinfo)
|
||||
|
||||
|
||||
def fromArray(data: List[int]) -> datetime:
|
||||
day = stringFormatters.leadingZero(str(data[0]))
|
||||
month = stringFormatters.leadingZero(str(data[1]))
|
||||
year = str(data[2])
|
||||
|
||||
return fromString(f"{day}/{month}/{year}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue