We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

HOW TO CREATE A FIELD DATE, you have the current date as the value ?. IF POSSIBLE IN VOLT AND PHTML

HOW TO CREATE A FIELD DATE, you have the current date as the value ?. IF POSSIBLE IN VOLT AND PHTML



3.5k
Accepted
answer

You can use helper https://docs.phalcon.io/en/latest/api/Phalcon_Forms_Element_Date.html More about tag helper read -> https://docs.phalcon.io/en/latest/reference/tags.html#helpers-to-generate-form-elements

Or if you create form in form class as described in https://docs.phalcon.io/en/latest/reference/forms.html use https://docs.phalcon.io/en/latest/api/Phalcon_Forms_Element_Date.html

Is it what you need?

P.S. don't forget input with type date support only Blink and Webkit based browser (Google Chrome, Safari, Opera) for another browser you need override class for detect browser and automatically switch to using some js plugin



81.2k
edited Oct '15

Also I had read the documentation but exactly what I need is having a field

{{Date_field ("date", "size": 32}}

assign the default of the current date. Previously he had done with JavaScript but giving me that I can get the current date with:

{{Date ('d-m-y', time ())}}

How to join the two? How do I assign a value to datefield?