Skip to content

Commit

Permalink
Permit VALUE=DATE parameter when parsing EXDATE and RDATE
Browse files Browse the repository at this point in the history
This parsing results to the first second of the day specified by date
  • Loading branch information
Egor Gorbunov committed Oct 18, 2018
1 parent 7241d28 commit d4eb820
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion str.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func StrToDatesInLoc(str string, defaultLoc *time.Location) (ts []time.Time, err
for _, param := range params {
if strings.HasPrefix(param, "TZID=") {
loc, err = parseTZID(param)
} else if param != "VALUE=DATE-TIME" {
} else if param != "VALUE=DATE-TIME" && param != "VALUE=DATE" {
err = fmt.Errorf("unsupported: %v", param)
}
if err != nil {
Expand Down
14 changes: 14 additions & 0 deletions str_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,20 @@ func TestSetParseLocalTimes(t *testing.T) {
})
}

func TestRDateValueDateStr(t *testing.T) {
input := []string{
"RDATE;VALUE=DATE:20180223",
}
s, err := StrSliceToRRuleSet(input)
if err != nil {
t.Error(err)
}
d := s.GetRDate()[0]
if !d.Equal(time.Date(2018, 02, 23, 0, 0, 0, 0, time.UTC)) {
t.Error("Bad time parsed: ", d)
}
}

// Helper for TestRFCSetStr and TestSetStr
func assertRulesMatch(set *Set, t *testing.T) {
// matching parsed RRules
Expand Down

0 comments on commit d4eb820

Please sign in to comment.