How to set default value to date type input field
See original GitHub issueI need to set a default value to date type input field. How would we go about doing that?
I have tried things like this
---
question: |
Information?
fields:
- Date: phone_date
datatype: date
default: |
as_datetime(today('dd/mm/yyyy'))
---
and a few other variations. I also scanned through the documentation and could not find a clear way.
Is there an easy solution to do this?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to set input type date's default value to today?
Use .defaultValue property of the input:date element to set the default value of the date to today's date.
Read more >HTML DOM Input Date defaultValue Property - W3Schools
The defaultValue property sets or returns the default value of a date field. Note: The default value is the value specified in the...
Read more ><input type="date"> - HTML: HyperText Markup Language
By default, <input type="date"> doesn't validate the entered value beyond its format. The interfaces generally don't let you enter anything that ...
Read more >HTML input date field, how to set default value to today's date?
HTML input date field, how to set default value to today's date? ; <div class="col"> ; <label for="date">Date</label> ; <input type="date" onload=" ...
Read more >HTML | DOM Input Date defaultValue Property - GeeksforGeeks
The Input Date defaultValue Property in HTML DOM is used to set or return the default value of a date field. This property...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Prior to 0.5.107, you had to format the default date in the format yyyy-MM-dd. As of 0.5.107, you can just do
default: today()
.I confirm that your solution is working. I was using an older version, way too old of a version.