Skip to content

Commit

Permalink
Revert changes to parseRRule() and add boolean 'fromString' to return…
Browse files Browse the repository at this point in the history
…ed rrule object

The returned object is either an rruleSet or an rrule, depending on wether the input string contained EXDATE/EXRULE or not. To account for this I remove the timezoneification of the dates here. It should be handled in the recurring.expand() function.
  • Loading branch information
joelzanden committed Apr 8, 2020
1 parent 09e14b2 commit 1abe7f2
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions packages/rrule/src/main.ts
Expand Up @@ -60,17 +60,9 @@ function parseRRule(input, dateEnv: DateEnv) {
let rrule

if (typeof input === 'string') {
let rruleTemp = rrulestr(input)
rrule = rrulestr(input)
rrule.fromString = true

if (rruleTemp.origOptions.dtstart != null) {
rruleTemp.origOptions.dtstart = dateEnv.createMarker(rruleTemp.origOptions.dtstart)
}

if (rruleTemp.origOptions.until != null) {
rruleTemp.origOptions.until = dateEnv.createMarker(rruleTemp.origOptions.until)
}

rrule = new RRule(rruleTemp.origOptions)
} else if (typeof input === 'object' && input) { // non-null object
let refined = { ...input } // copy

Expand Down Expand Up @@ -104,6 +96,7 @@ function parseRRule(input, dateEnv: DateEnv) {
}

rrule = new RRule(refined)
rrule.fromString = false
}

if (rrule) {
Expand Down

0 comments on commit 1abe7f2

Please sign in to comment.