Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add test case for selecting the same day as start and end date

Henriette Darge65af828ff28e
diff --git a/frontend/src/app/components/datepicker/datepicker.modal.ts b/frontend/src/app/components/datepicker/datepicker.modal.ts
index 401fdb2ad2c..94e5563d47b 100644
--- a/frontend/src/app/components/datepicker/datepicker.modal.ts
+++ b/frontend/src/app/components/datepicker/datepicker.modal.ts
@@ -147,8 +147,8 @@ export class DatePickerModal extends OpModalComponent implements AfterViewInit {
}
updateDate(key:DateKeys, val:string) {
- // Epxected minimal format YYYY-M-D => 8 characters
- if (val.length >= 8) {
+ // Expected minimal format YYYY-M-D => 8 characters OR empty
+ if (val.length >= 8 || val.length === 0) {
this.dates[key] = val;
if (this.datepickerHelper.validDate(val) && this.datePickerInstance) {
this.enforceManualChangesToDatepicker(false);
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index 1b95f060436..3f3dd5836dc 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -79,6 +79,21 @@ describe 'date inplace editor',
start_date.expect_state_text '2016-01-01 - ' + Date.today.strftime('%Y-%m-%d')
end
+ it 'can set start and due date to the same day' do
+ start_date.activate!
+ start_date.expect_active!
+
+ # Set the due date
+ start_date.datepicker.set_date Date.today, true
+ # As the to be selected date is automatically toggled,
+ # we can directly set the start date afterwards to the same day
+ start_date.datepicker.set_date Date.today, true
+
+ start_date.save!
+ start_date.expect_inactive!
+ start_date.expect_state_text Date.today.strftime('%Y-%m-%d') + ' - ' + Date.today.strftime('%Y-%m-%d')
+ end
+
it 'saves the date when clearing and then confirming' do
start_date.activate!