Fixed wholeDay time validation

This commit is contained in:
Andreas Schneider 2018-04-02 13:03:41 +02:00
parent 580dafe123
commit 8affef4d65
1 changed files with 4 additions and 4 deletions
src/calanonsync

View File

@ -83,14 +83,14 @@ var fieldMatch = regexp.MustCompile(`^(\w+)[;:]`)
// they are converted to local timezone and tried again. If that
// also fails the event is NOT considered whole day!
func (ical *ICal) Update(newStart, newEnd time.Time, wholeDay bool) {
if wholeDay && (newStart.Hour() != 0 || newStart.Minute() != 0 ||
newEnd.Hour() != 0 || newEnd.Hour() != 0) {
if wholeDay && (newStart.Hour() != 0 || newStart.Minute() != 0 || newStart.Second() != 0 ||
newEnd.Hour() != 0 || newEnd.Minute() != 0 || newEnd.Second() != 0) {
newStart = newStart.In(time.Local)
newEnd = newEnd.In(time.Local)
if newStart.Hour() != 0 || newStart.Minute() != 0 ||
newEnd.Hour() != 0 || newEnd.Hour() != 0 {
if newStart.Hour() != 0 || newStart.Minute() != 0 || newStart.Second() != 0 ||
newEnd.Hour() != 0 || newEnd.Minute() != 0 || newEnd.Second() != 0 {
log.Printf("Cannot update event %s as whole day.\n", ical.UID())
wholeDay = false