Skip to content

feat(events): autofill and bound End Date from Start Date - #315

Merged
harshtandiya merged 1 commit into
developfrom
chore/end-date-autofill
Aug 3, 2026
Merged

feat(events): autofill and bound End Date from Start Date#315
harshtandiya merged 1 commit into
developfrom
chore/end-date-autofill

Conversation

@harshtandiya

Copy link
Copy Markdown
Collaborator

Picking a Start Date on Buzz Event left End Date entirely on the user, and nothing stopped them from putting it before the start. The server caught that on save via validate_from_to_dates, but only after a full round trip.

Three small things in buzz_event.js:

  • Start Date fills an empty End Date with the same value. Non-empty End Date is left alone.
  • If the new Start Date is past the existing End Date, End Date is pulled forward to match and an alert says so. Silently saving an invalid range was the alternative.
  • The End Date picker gets a minDate, so earlier dates aren't offered in the first place.

Gotchas worth knowing:

min_date on the docfield is only read once, when the control builds its picker — set_df_property does nothing after that. The limit has to go onto the datepicker instance directly (field.datepicker.update({ minDate })), same as frappe/form/reminders.js does. Hence the set_end_date_limit helper, called from both refresh and start_date.

minDate is inclusive, so end == start is still allowed. It has to be — single-day events are the common case and the autofill produces exactly that.

Dates are YYYY-MM-DD strings, so the < comparison is chronological. No date lib needed.

Not changed:

  • No new server-side validation. validate_dates already calls validate_from_to_dates("start_date", "end_date"); this is a UX layer on top, not a replacement.
  • validate_schedule untouched. Pulling End Date forward can now strand schedule rows past it — the server already throws on those, which is the right place for it.

Desk-only change, no dashboard impact.

Setting Start Date now fills an empty End Date with the same value, and
pulls End Date forward (with an alert) if it would fall before the start.
The End Date picker also gets a minDate so earlier dates aren't offered.
min_date on the docfield is only read when the control builds its picker,
so the limit has to be pushed onto the datepicker instance directly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@harshtandiyaharshtandiya added the backport main backport to main branch label Aug 3, 2026
@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds client-side handling that synchronizes and bounds an event’s End Date when its Start Date changes.

  • Autofills an empty End Date from the selected Start Date.
  • Moves an earlier End Date forward and displays an alert.
  • Applies an inclusive minimum date directly to the End Date picker on refresh and Start Date changes.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The new handler preserves existing non-empty valid End Dates, corrects invalid ranges, and refreshes the picker constraint while retaining server-side validation.

Important Files Changed

FilenameOverview
buzz/events/doctype/buzz_event/buzz_event.jsAdds Start Date-driven End Date synchronization and updates the End Date picker’s minimum selectable date; no concrete defect was established.

Reviews (1): Last reviewed commit: "feat(events): autofill and bound End Dat..." | Re-trigger Greptile

@harshtandiya
harshtandiya merged commit 73c1f58 into developAug 3, 2026
9 checks passed
@harshtandiya
harshtandiya deleted the chore/end-date-autofill branch August 3, 2026 06:43
@github-actions

Copy link
Copy Markdown
Contributor

Successfully created backport PR for main:

harshtandiya added a commit that referenced this pull request Aug 3, 2026
feat(events): autofill and bound End Date from Start Date (#315)
Setting Start Date now fills an empty End Date with the same value, and
pulls End Date forward (with an alert) if it would fall before the start.
The End Date picker also gets a minDate so earlier dates aren't offered.
min_date on the docfield is only read when the control builds its picker,
so the limit has to be pushed onto the datepicker instance directly.
(cherry picked from commit 73c1f58)
Co-authored-by: Harsh Tandiya <harsh.tandiya@gmail.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport mainbackport to main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@harshtandiya