Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"IsDuring" function #110

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
3 changes: 2 additions & 1 deletion calendar.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ func (cal *Calendar) SetDescription(s string, params ...PropertyParameter) {
}

func (cal *Calendar) SetLastModified(t time.Time, params ...PropertyParameter) {
cal.setProperty(PropertyLastModified, t.UTC().Format(icalTimestampFormatUtc), params...)
layout, params := timestampFormatForTime(t, params)
cal.setProperty(PropertyLastModified, t.Format(layout), params...)
}

func (cal *Calendar) SetRefreshInterval(s string, params ...PropertyParameter) {
Expand Down
12 changes: 6 additions & 6 deletions calendar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func TestTimeParsing(t *testing.T) {
},
}

assertTime := func(evtUid string, exp time.Time, timeFunc func() (given time.Time, err error)) {
assertTime := func(t *testing.T, evtUid string, exp time.Time, timeFunc func() (given time.Time, err error)) {
given, err := timeFunc()
if err == nil {
if !exp.Equal(given) {
Expand All @@ -104,17 +104,17 @@ func TestTimeParsing(t *testing.T) {
}

for _, tt := range tests {
t.Run(tt.uid, func(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
evt, ok := eventMap[tt.uid]
if !ok {
t.Errorf("Test %#v, event UID not found, %s", tt.name, tt.uid)
return
}

assertTime(tt.uid, tt.start, evt.GetStartAt)
assertTime(tt.uid, tt.end, evt.GetEndAt)
assertTime(tt.uid, tt.allDayStart, evt.GetAllDayStartAt)
assertTime(tt.uid, tt.allDayEnd, evt.GetAllDayEndAt)
assertTime(t, tt.uid, tt.start, evt.GetStartAt)
assertTime(t, tt.uid, tt.end, evt.GetEndAt)
assertTime(t, tt.uid, tt.allDayStart, evt.GetAllDayStartAt)
assertTime(t, tt.uid, tt.allDayEnd, evt.GetAllDayEndAt)
})
}
}
Expand Down
Loading
Loading