Added and changed formats
This commit is contained in:
parent
225963aaeb
commit
bd03a2b604
1 changed files with 19 additions and 4 deletions
|
@ -1,12 +1,18 @@
|
||||||
from settings import hours
|
from settings import hours, language
|
||||||
|
|
||||||
first_occurrence_char = '['
|
first_occurrence_char = '['
|
||||||
middle_occurrence_char = '|'
|
middle_occurrence_char = '|'
|
||||||
last_occurrence_char = ']'
|
last_occurrence_char = ']'
|
||||||
|
|
||||||
|
allday_lang = {
|
||||||
|
"en" : "All day",
|
||||||
|
"de" : "Ganztägig"
|
||||||
|
}
|
||||||
|
allday_detailed = allday_lang[language]
|
||||||
|
|
||||||
def time_str (dt):
|
def time_str (dt):
|
||||||
if hours is "12":
|
if hours is "12":
|
||||||
return dt.strftime("%I:%M %p")
|
return dt.strftime("%I:%M%p")
|
||||||
elif hours is "24":
|
elif hours is "24":
|
||||||
return dt.strftime("%H:%M")
|
return dt.strftime("%H:%M")
|
||||||
else:
|
else:
|
||||||
|
@ -44,10 +50,19 @@ def event_time_summary (event):
|
||||||
else:
|
else:
|
||||||
return time_str(event.begin_datetime)
|
return time_str(event.begin_datetime)
|
||||||
|
|
||||||
|
def event_time_detailed (event):
|
||||||
|
if event.allday:
|
||||||
|
return allday_detailed
|
||||||
|
else:
|
||||||
|
return time_str(event.begin_datetime) + " - " + time_str(event.end_datetime)
|
||||||
|
|
||||||
def date_str(dt):
|
def date_str(dt):
|
||||||
return self.__remove_leading_zero__(dt.strftime('%d %b'))
|
return __remove_leading_zero__(dt.strftime('%d. %b'))
|
||||||
|
|
||||||
def remove_leading_zero (text):
|
def remove_leading_zero (text):
|
||||||
while text[0] is '0':
|
while text[0] is '0':
|
||||||
text = text[1:]
|
text = text[1:]
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
def date_summary_str(dt):
|
||||||
|
return dt.strftime('%a %d. %b')
|
Loading…
Reference in a new issue