I have an Vue component, passing dates with axios requests.
I have an input where i introduce the date, for ex. ("2021-03-06"), it's working, but if i use an datePicker it's doesn't.
public function store()
{
$attributes = request();
Task::create([
'name' => $attributes['name'],
'client_id' => $attributes['client_id'],
'task_date' => $attributes['task_date'],
'state' => 1,
'type' => $attributes['type'],
'details' => $attributes['details'],
'invoiced_date' => $attributes['invoiced_date'],
'programing_worked_minutes' => $attributes['programing_worked_minutes'],
'support_worked_minutes' => $attributes['support_worked_minutes'],
'closed_date' => null,
]);
return 1;
}
<datepicker
v-model="task.task_date"
:lower-limit="new Date()"
placeholder="click here to choose a date"
id="task_date"
name="task.task_date"
class="block rounded p-0 shadow-inner border-gray-300 w-1/2"
required
/>
export default {
name: "addTask",
components: {
Datepicker
},
data() {
return {
task: {
name: null,
client_id: null,
task_date: null,
type: null,
details: null,
invoiced_date: null,
programing_worked_minutes: null,
support_worked_minutes: null,
},
message: "",
visual_spinner: false,
}
},
methods: {
sendData() {
this.message = '';
this.visual_spinner = true;
axios.post('/create-task', {
name: this.task.name,
client_id: this.task.client_id,
task_date: this.task.task_date,
type: this.task.type,
details: this.task.details,
invoiced_date: this.task.invoiced_date,
programing_worked_minutes: this.task.programing_worked_minutes,
support_worked_minutes: this.task.support_worked_minutes,
})
.then((response) => {
this.onSuccess();
})
.catch(function (error) {
console.log(error);
});
},
So, the request it working well, the problem is with the format Date , if is 2021-03-01 its working but if it's Sat Mar 13 2021 00:00:00 GMT+0200 (Eastern European Standard Time) not working
Thank you