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

Wrong Daily reccurrence generating between #5

Open
Saulenco opened this issue Jun 26, 2019 · 0 comments
Open

Wrong Daily reccurrence generating between #5

Saulenco opened this issue Jun 26, 2019 · 0 comments

Comments

@Saulenco
Copy link

Saulenco commented Jun 26, 2019

the repeating is daily count 5 from 24.06.2019 and last instance is on 28.06.2019
but the result of rule.getOccurrencesBetween return 5 occurrences from 28.06.2019

func customRuleGenerator() {
        let appointentStart = "24.06.2019"
        
        let windowStart = "28.06.2019"
        let windowEnd = "28.09.2019"
        
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = "dd.MM.yyyy"
        
        let rule = getRule(for: dateFormatter.date(from: appointentStart)!)
        let occurrences = rule.getOccurrencesBetween(beginDate: dateFormatter.date(from: windowStart)!, endDate: dateFormatter.date(from: windowEnd)!)
        
        print(occurrences)
        
    }
    
    func getRule( for start: Date) -> rrule {
        //frequency
        let rrulefrequency: RruleFrequency = .daily
        
        //dtstart
        let rruledtstart = start
        
        //until
        let rruleuntil: Date? = nil
        
        //count
        var rrulecount: Int? = 5

        //interval
        var rruleinterval: Int = 1

        //wkst
        let rrulewkst = 1 //TODO: implement week start
        
        //byweekday
        let rrulebyweekday: [Int] = []
        
        //byweekno
        let rrulebyweekno: [Int] = []
        
        //bymonth
        let rrulebymonth: [Int] = []
        
        //bymonthday
        let rrulebymonthday: [Int] = [] // if monthly and there is no weekDays
        
        //byyearday
        let rrulebyyearday: [Int] = []
        
        //bysetpos
        let rrulebysetpos: [Int] = []
        
        let rule = rrule(frequency: rrulefrequency, dtstart: rruledtstart, until: rruleuntil, count: rrulecount, interval: rruleinterval, wkst: rrulewkst, bysetpos: rrulebysetpos, bymonth: rrulebymonth, bymonthday: rrulebymonthday, byyearday: rrulebyyearday, byweekno: rrulebyweekno, byweekday: rrulebyweekday, byhour: [], byminute: [], bysecond: [])
        
        return rule
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant