Skip to content

Bugfix: Fix correct deadline/start date validation in job creation form#2314

Open
CelineLahnor wants to merge 10 commits intomainfrom
bugfix/1487-prevent-invalid-job-dates-where-start-date-is-earlier-than-application-deadline
Open

Bugfix: Fix correct deadline/start date validation in job creation form#2314
CelineLahnor wants to merge 10 commits intomainfrom
bugfix/1487-prevent-invalid-job-dates-where-start-date-is-earlier-than-application-deadline

Conversation

@CelineLahnor
Copy link
Copy Markdown
Contributor

@CelineLahnor CelineLahnor commented Apr 18, 2026

Checklist

General

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data (e.g. using paging).
  • I strictly followed the principle of data economy for all client-server REST calls.
  • I strictly followed the client coding and design guidelines.
  • I added multiple integration tests (Vitest) related to the features (with a high test coverage), while following the client test guidelines.
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.

Motivation and Context

Closes #1487

Description

This PR prevents invalid date combinations in the professor job creation form by enforcing that the start date must be the same day as or later than the application deadline.

Changes

  • added client-side validation so startDate must be the same day as or later than applicationDeadline
  • disabled invalid dates in both date pickers depending on which date is selected first
  • highlighted the reference date in the datepicker with a tooltip
  • extracted shared local date parsing logic
  • moved datepicker styling to Tailwind
  • added some small client tests for this behavior

Steps for Testing

  1. Log in as Professor
  2. Create a new position draft
  3. Select a Start Date
  4. Open the Deadline Date Picker and verify that the User can not pick a Deadline after the Start Date
  5. Verify the Start Date is highlighted within the Date Picker
  6. After selecting a Deadline verify this is also highlighted in the Date Picker for the Start Date
  7. Verify that the User can not pick a Start Date before the Deadline

Review Progress

Code Review

  • Code Review 1

Manual Tests

  • Test 1

Screenshots

Bildschirmaufnahme.2026-04-18.um.15.32.32.mov

I also updated the job creation form so the start date picker appears on the left and the application deadline picker on the right, matching the intended UI order.
Bildschirmfoto 2026-04-19 um 16 23 26

Test Coverage

Client

Class/File Line Coverage Lines Expects Ratio
slot-creation-form.component.ts 0.00% 342 40 11.7
job-creation-form.component.ts 63.77% 1116 137 12.3
datepicker.component.ts 100.00% 162 39 24.1
saving-states.ts 100.00% 7 ? ?
date-time.util.ts 45.16% 57 ? ?
date-order-validator.ts 90.90% 18 ? ?

Last updated: 2026-04-19 15:30:23 UTC

@github-actions github-actions bot added client Pull requests that update TypeScript code. (Added Automatically!) tests labels Apr 18, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 18, 2026

Not up to standards ⛔

🔴 Issues 1 medium

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Complexity 1 medium

View in Codacy

🟢 Metrics 33 complexity

Metric Results
Complexity 33

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@CelineLahnor CelineLahnor marked this pull request as ready for review April 19, 2026 10:31
…start-date-is-earlier-than-application-deadline
@CelineLahnor CelineLahnor requested a review from az108 as a code owner April 19, 2026 10:31
Copilot AI review requested due to automatic review settings April 19, 2026 10:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes invalid date combinations in the professor job creation form by ensuring the position start date cannot be earlier than the application deadline, and by improving the datepicker UX to guide correct selection.

Changes:

  • Add a shared form-group validator to enforce startDate >= applicationDeadline.
  • Derive datepicker min/max bounds from the opposite selected date and visually highlight the reference date with a tooltip.
  • Extract shared local date parsing logic and expand Vitest coverage for the new behavior.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Adds date-order validation, computed min/max bounds for date pickers, and blocks autosave when date order is invalid.
src/main/webapp/app/job/job-creation-form/job-creation-form.component.html Wires new min/max bounds and highlighted reference date tooltips into both date pickers.
src/main/webapp/app/shared/validators/date-order-validator.ts Introduces a reusable cross-field validator for ISO local date strings.
src/main/webapp/app/shared/util/date-time.util.ts Adds parseLocalDateString for timezone-safe parsing of YYYY-MM-DD into local-midnight Date.
src/main/webapp/app/shared/components/atoms/datepicker/datepicker.component.ts Uses shared local date parsing and adds highlighted-day detection.
src/main/webapp/app/shared/components/atoms/datepicker/datepicker.component.html Moves styling to Tailwind and renders the highlighted reference day with a tooltip.
src/main/webapp/app/shared/components/atoms/datepicker/datepicker.component.scss Removes SCSS styling now replaced by Tailwind selectors.
src/main/webapp/i18n/en/job.json Updates placeholder text and adds labels for highlighted reference dates.
src/main/webapp/i18n/de/job.json Updates placeholder text and adds labels for highlighted reference dates.
src/test/webapp/app/job/job-creation-form/job-creation-form.component.spec.ts Adds tests for date-order validity and derived datepicker bounds.
src/test/webapp/app/shared/components/atoms/datepicker/datepicker.component.spec.ts Adds a test for highlighted reference date detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/webapp/app/shared/components/atoms/datepicker/datepicker.component.html Outdated
Comment thread src/main/webapp/app/job/job-creation-form/job-creation-form.component.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Pull requests that update TypeScript code. (Added Automatically!) ready for review tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prevent invalid job dates where start date is earlier than application deadline

2 participants