Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/js/components/fieldtypes/DateFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default {
},
datePickerValue() {
if (!this.value) {
if (!this.value || this.value === 'now') {
return null;
}
Expand Down
10 changes: 9 additions & 1 deletion resources/js/tests/components/fieldtypes/DateFieldtype.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const makeDateField = (props = {}) => {
},
global: {
provide: {
[containerContextKey]: {}
[containerContextKey]: {
withoutDirtying: (callback) => callback(),
}
},
mocks: {
$config: {
Expand Down Expand Up @@ -74,3 +76,9 @@ test.each([

expect(dateField.vm.datePickerValue.toString()).toBe(expectedDate);
});

test('datePickerValue returns null when value is "now"', () => {
const dateField = makeDateField({ value: 'now' });

expect(dateField.vm.datePickerValue).toBe(null);
});