Anthony Shoshi Gomes
Anthony Shoshi Gomes

Reputation: 73

Date not showing in date input field laravel 5.8

While I retrieve data from database, I have a column named 'deadline' it do not displaying in my blade date input field. date input format is 'mm/dd/yyyy'. I tried to format as it is but it do not work. Here is my code for blade file <input type="date" class="form-control @error('deadline') is-invalid @enderror" name="deadline" value="{{ date('m/d/Y', strtotime($job->deadline)) }}">

I have inspected this field and it shows value correctly but do not appear on by for input I inspect this field and it shows value correctly but do not appear on by for input

Here is my output screenshot Here is my output screenshot

Upvotes: 1

Views: 3975

Answers (3)

rahali badr eddine
rahali badr eddine

Reputation: 77

value="{{\Illuminate\Support\Carbon::parse($quote->date_quote)->format("Y-m-d")}}" type="date you should make sure that the value you write is that format (2023-12-30)

Upvotes: 0

Oxeda
Oxeda

Reputation: 1

Try this

value="{{ date('m-d-Y', strtotime($job->deadline)) }}"

Upvotes: 0

iamab.in
iamab.in

Reputation: 2070

From this reference:

One thing to note is that the displayed date format differs from the actual value — the displayed date format will be chosen based on the set locale of the user's browser, whereas the date value is always formatted yyyy-mm-dd

You should set value property in yyyy-mm-dd format. The output formatting will be based on the user's browser locale. ie, you may not be able to customize <input type="date"> output format.

<input type="date" name="bday" value="2019-09-23">

Upvotes: 5

Related Questions