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