django-recurrence icon indicating copy to clipboard operation
django-recurrence copied to clipboard

Generating Recurrence Programmatically or Via Field

Open bobozar opened this issue 4 years ago • 0 comments

From the API, the frontend will send me, start_date, end_date and time with each having a datetime obj. The interval should be rrule text. example, FREQ=DAILY;INTERVAL=2;COUNT=4 . Now, how do I pass the interval text value, alongside the start and end datetime to get the recurrence between the two dates?

Something like below example.

  start_rdt = utc_start_date_time
  end_rde = utc_end_date_time
  interval =  "FREQ=DAILY;INTERVAL=2;COUNT=4"
  mypattern = recurrence.Recurrence(rrules=[recurrence.Rule(interval)])]).between(start_rdt, end_rde,
  dtstart=start_rdt, inc=True)
  return mypattern

Or can I merge the interval text string with start and end datetime as value to the RecurrenceField?

bobozar avatar Jun 29 '20 12:06 bobozar