Now, let's try to add one more field to our form and database: due_date with a date picker.
Prepare Database/Controller
I will just show you the code without any comments. These are Laravel fundamentals, I'm sure you know them.
Migration:
php artisan make:migration add_due_date_to_tasks_table
Schema::table('tasks', function (Blueprint $table) { $table->date('due_date')->nullable();});
Then, we run:
php artisan migrate
Adding to...
in Create.vue:
const submitForm = () => { form.transform((data) => ({ ...data, due_date: data.due_date ? data.due_date.toDate(getLocalTimeZone()) : null, ... toDate is red underlined. Property 'toDate' does not exist on type 'never'.ts-plugin(2339)
I am not sure on how to best fix this issue at this time. Will play around with more time at hand as this one might require more changes, sorry.
ps. Warnings like this are annoying, but at this point - it doesn't impact the functionality.
Yes, doesn't impact on funcionality. Typescript sometimes is too strict, maybe
in Edit.vue:
due_date: task.due_date ? fromDate(new Date(task.due_date)) : null,
'due_date' is red underlined Type 'ZonedDateTime | null' is not assignable to type 'FormDataConvertible'. Type 'ZonedDateTime' is not assignable to type 'FormDataConvertible'. Type 'ZonedDateTime' is not assignable to type '{ [key: string]: FormDataConvertible; }'. Index signature for type 'string' is missing in type 'ZonedDateTime'.ts-plugin(2322)
types.d.ts(104, 38): An argument for 'timeZone' was not provided. (alias) fromDate(date: Date, timeZone: string): ZonedDateTime import fromDate Takes a Date object and converts it to the provided time zone.
I'm not sure about the type errors you mentioned, but... Can you expand on the
except paginationpart?https://github.com/kkcdp/vue-todo-project, My repository, maybe it helps. Pagination part is replaced