question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set default value to date type input field

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jhpylecommented, Apr 19, 2020

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().

0reactions
vrst37commented, Apr 20, 2020

I confirm that your solution is working. I was using an older version, way too old of a version.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found