Skip to content

Commit 6defb42

Browse files
Copilotduncanmccleanjasonvarga
authored
[6.x] Fix Invalid ISO 8601 date time string error from Date Fieldtype (#13701)
Co-authored-by: duncanmcclean <19637309+duncanmcclean@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Jason Varga <jason@pixelfear.com>
1 parent 8563d35 commit 6defb42

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

resources/js/components/fieldtypes/DateFieldtype.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default {
6868
},
6969
7070
datePickerValue() {
71-
if (!this.value) {
71+
if (!this.value || this.value === 'now') {
7272
return null;
7373
}
7474

resources/js/tests/components/fieldtypes/DateFieldtype.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ const makeDateField = (props = {}) => {
2929
},
3030
global: {
3131
provide: {
32-
[containerContextKey]: {}
32+
[containerContextKey]: {
33+
withoutDirtying: (callback) => callback(),
34+
}
3335
},
3436
mocks: {
3537
$config: {
@@ -74,3 +76,9 @@ test.each([
7476

7577
expect(dateField.vm.datePickerValue.toString()).toBe(expectedDate);
7678
});
79+
80+
test('datePickerValue returns null when value is "now"', () => {
81+
const dateField = makeDateField({ value: 'now' });
82+
83+
expect(dateField.vm.datePickerValue).toBe(null);
84+
});

0 commit comments

Comments
 (0)