From fb9223c6c3fe0e9d70c313ea28129b1208e110f5 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Sat, 25 Feb 2023 21:30:42 +0100 Subject: [PATCH 1/2] fixed: poor user experience when entering dates that are too high for the current month --- AppKit/CPDatePicker/_CPDatePickerElementTextField.j | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/AppKit/CPDatePicker/_CPDatePickerElementTextField.j b/AppKit/CPDatePicker/_CPDatePickerElementTextField.j index 012a7a81a..e5f20a711 100644 --- a/AppKit/CPDatePicker/_CPDatePickerElementTextField.j +++ b/AppKit/CPDatePicker/_CPDatePickerElementTextField.j @@ -385,6 +385,18 @@ CPAMPMDateType = 6; return; } + // if we enter a day that is too high for the current month + // we need to increase the month by one + // if we do not do this, the user input woul be silently reset + // very poor user experience + + if (parseInt(anObjectValue, 10) > [dateValue _daysInMonth]) + { + [_datePickerElementView._textFieldMonth setIntValue:(dateValue.getMonth() + 2)]; + [super setObjectValue:objectValue]; + return; + } + [super setObjectValue:objectValue]; break; From 29502d10ebbff252ed015f687c23d369771e85a3 Mon Sep 17 00:00:00 2001 From: daboe01 Date: Thu, 21 Dec 2023 19:59:38 +0100 Subject: [PATCH 2/2] formatting --- AppKit/CPDatePicker/_CPDatePickerElementTextField.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPDatePicker/_CPDatePickerElementTextField.j b/AppKit/CPDatePicker/_CPDatePickerElementTextField.j index e5f20a711..8bdb0b1ac 100644 --- a/AppKit/CPDatePicker/_CPDatePickerElementTextField.j +++ b/AppKit/CPDatePicker/_CPDatePickerElementTextField.j @@ -387,7 +387,7 @@ CPAMPMDateType = 6; // if we enter a day that is too high for the current month // we need to increase the month by one - // if we do not do this, the user input woul be silently reset + // if we do not do this, the user input would be silently reset // very poor user experience if (parseInt(anObjectValue, 10) > [dateValue _daysInMonth])