'How to display the Date in the form for Updating?

  • install date-fns NPM in express.
format(new Date(2014, 1, 11), 'yyyy-MM-dd')
//=> '2014-02-11'
  • we can display the date in the form for updating date.
     <input type="date" name="start_date" placeholder="Start-Date" value="<%= format(event.start_date,'yyyy-MM-dd') %>">
            <input type="date" name="end_date" placeholder="End-Date" value="<%= format(event.end_date , 'yyyy-MM-dd') %>">


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source