Hai,
I was confused when trying 2 times the request with date pikaday on change
the first request was successful but the second request failed with the 500 status code,
Is there something wrong with worklfow?
succes request first
error request second at i change date
code my live wire
class Employees extends Component
{
public $date;
public $data;
public function cek()
{
$tanggal = \Carbon\carbon::parse($this->date)->todatestring();
$data = DB::select("
select * from pegawai where hire_date = '".$tanggal."'
");
$this->data = $data;
}
public function render()
{
return view('livewire.employees');
}
}
livewire view
<div class="form-inline mt-3" wire:ignore>
<input type="text" class="form-control" placeholder="Tanggal" id="datepicker" autocomplete="off">
{{-- <input type="date" class="form-control" placeholder="Tanggal" wire:model="date" autocomplete="off"> --}}
<button wire:click = "cek" class="btn btn-info">Proses</button>
<script>
var picker = new Pikaday({
field: document.getElementById('datepicker'),
format: 'D-MMM-YYYY',
yearRange: [1990, 2030],
onSelect: function() {
console.log(this.getMoment().format('Do MMMM YYYY'));
}
});
$('#datepicker').on('change', function (e) {
@this.set('date', e.target.value);
});