q-input date - what am I missing?
I want a simple date input to show the format: YYYY-DD-MM (with dashes). I read around and did the following accordingly:
<q-input formatModel="string" format="YYYY-MM-DD" class="full-width" v-model="newTransactionWhen" rounded outlined type="date" stack-label label="When" :rules="[ val => val && val.length > 0 || 'When is missing']"/>
For some reason, it insists on showing it as mm/dd/yyyy. I read that dashes is a problem (why?) so I changed the format above to
but still it insists on mm/dd/yyyy. What am I doing wrong? Thanks
s.molinari last edited by
Where did you get
formatas a prop? It isn’t one.
maskis the prop you need.
mask does not work with type=“date”
<q-input mask="####-##-##" class="full-width" v-model="newTransactionWhen" rounded outlined type="date" stack-label label="When" :rules="[ val => val && val.length > 0 || 'When is missing']"/>
I saw format and formatModel here:
@amoss you should head to mdn docs as you are tapping into a native type date. Why not just use qdate with qinput? And btw you were looking into an issue that isnt relevant to v1, check the dates in that gh ticket.
The combination felt a bit cumbersome to me…
I saw the date of that ticket but I was hoping it just got better since, just like the whole quasar framework which is magnificent
So I understand it is not possible?
@amoss like i said look into mdn docs, iirc they use preg match or etc. But ofc you have the power how the model will be shaped when you set it via date format utils, but as to displaying in a native manner, its a matter of creating a component of your own, so i dont see why not use qdate :/.
When clicking the icon to open qdate, it has no icon to close.
I know that clicking outside will close it but it looks less intuitive for the user. I think.
I know all can be fixed with my own layout, I just thought there is something out of the box.
@amoss you can use default slot to make a set button of some sort, or use input event to close the qdate when user picks a date.
This post is deleted!