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

Widget should include a field for dtstart

Open jelko opened this issue 11 years ago • 7 comments

The javascript part of RecurrenceWidget should include a way to add a start date to a rule. Right now none is saved. This leads to a dtstart of datetime.now() when the occurrences are generated. For most users this is probably not a desired behavior.

jelko avatar Jun 28 '13 18:06 jelko

I'm conflicted here. I wonder if that's better obtained separately - not all uses of django-recurrence will want that (in my apps I always want datetime.now () for dtstart as it happens).

If you want something different, you can do this with RecurrenceField already, just add another date field on your form and use:

obj.recurrences.occurences (dtstart=obj.other_date)

when generating recurrences.

Does that work for you?

The alternative is adding another field type (probably just a form field type), with an extra date selector, but I'd prefer to avoid complicating the JS further if we can.

Dom

dominicrodger avatar Jul 29 '13 07:07 dominicrodger

For my use-case, it would make sense to have dtstart and dtend as part of the main widget. I'd suggest making this an option that gets passed into the widget. And with an optional keyword argument that can be passed into the model and form field definition. That way it can be backwards compatible for existing users but is easy to add for users that need it.

stefanfoulis avatar May 28 '17 13:05 stefanfoulis

I have a use case when the admin must specify a recurring set of promo dates that begins on a specific date. For example, every Tuesday for 3 months, starting from 1 of June. Now we need to remember to generate that before the first Tuesday of June to create this properly, and it is a bit awkward.

Solution described by @stefanfoulis would be perfect.

parrker avatar May 01 '18 18:05 parrker

In my current use case it would also make sense to be able to set dtstart directly in the form widget. I like @stefanfoulis backwards-compatible solution. If there is a fair chance of it being merged, I would take a shot at tackling this (optional) feature in a pull request.

zepp133 avatar Feb 12 '19 14:02 zepp133

Hi @zepp-lee - I'm open to merging something like @stefanfoulis suggests if it can be done without adding too much complication to the JS.

dominicrodger avatar Feb 18 '19 20:02 dominicrodger

Has this completed being ignored?

rchaud avatar Oct 15 '19 18:10 rchaud

If someone has a patch for this that can be merged, without complicating the JS too much, it'll be merged.

dominicrodger avatar Oct 15 '19 19:10 dominicrodger