kopia lustrzana https://github.com/collective/icalendar
fix: cli does not support DURATION #354
rodzic
514fb1b4f9
commit
7a8d584b85
|
@ -8,6 +8,7 @@ Changelog
|
|||
Minor changes:
|
||||
|
||||
- removed deprecated test checks [tuergeist]
|
||||
- Fix: cli does not support DURATION #354 [mamico]
|
||||
|
||||
Breaking changes:
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ icalendar contributors
|
|||
- Robert Spralja <robert.spralja@gmail.com>
|
||||
- Maurits van Rees <maurits@vanrees.org>
|
||||
- jacadzaca <vitouejj@gmail.com>
|
||||
- Mauro Amico <mauro.amico@gmail.com>
|
||||
|
||||
Find out who contributed::
|
||||
|
||||
|
|
|
@ -46,10 +46,17 @@ def view(event):
|
|||
description = '\n'.join(map(lambda s: s.rjust(len(s) + 5), description))
|
||||
|
||||
start = event.decoded('dtstart')
|
||||
end = event.decoded('dtend', default=start)
|
||||
duration = end - start
|
||||
start = start.astimezone(start.tzinfo).strftime('%c')
|
||||
end = end.astimezone(end.tzinfo).strftime('%c')
|
||||
if 'duration' in event:
|
||||
end = event.decoded('dtend', default=start + event.decoded('duration'))
|
||||
else:
|
||||
end = event.decoded('dtend', default=start)
|
||||
duration = event.decoded('duration', default=end - start)
|
||||
if isinstance(start, datetime):
|
||||
start = start.astimezone(start.tzinfo)
|
||||
start = start.strftime('%c')
|
||||
if isinstance(end, datetime):
|
||||
end = end.astimezone(end.tzinfo)
|
||||
end = end.strftime('%c')
|
||||
|
||||
return f""" Organizer: {organizer}
|
||||
Attendees:
|
||||
|
@ -78,4 +85,3 @@ def main():
|
|||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@ DTEND;TZID=Europe/Warsaw:20220820T203000
|
|||
LOCATION:New Amsterdam, 1010 Test Street
|
||||
DESCRIPTION:Test Description\\nThis one is multiline
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
UID:1
|
||||
SUMMARY:TEST
|
||||
DTSTART:20220511
|
||||
DURATION:P5D
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
||||
'''
|
||||
|
||||
|
@ -57,6 +63,18 @@ PROPER_OUTPUT = ''' Organizer: organizer <organizer@test.test>
|
|||
Test Description
|
||||
This one is multiline
|
||||
|
||||
Organizer:
|
||||
Attendees:
|
||||
|
||||
Summary : TEST
|
||||
Starts : Wed May 11 00:00:00 2022
|
||||
End : Mon May 16 00:00:00 2022
|
||||
Duration : 5 days, 0:00:00
|
||||
Location :
|
||||
Comment :
|
||||
Description:
|
||||
|
||||
|
||||
'''
|
||||
|
||||
class CLIToolTest(unittest.TestCase):
|
||||
|
|
Ładowanie…
Reference in New Issue