No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    q-input date - what am I missing?

    Framework
    3
    10
    5955
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amoss last edited by

      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

      format="YYYY/MM/DD"
      

      but still it insists on mm/dd/yyyy. What am I doing wrong? Thanks

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        Where did you get format as a prop? It isn’t one.

        mask is the prop you need.

        https://codepen.io/smolinari/pen/WNbVbNB?editors=1010

        Scott

        A 1 Reply Last reply Reply Quote 0
        • A
          amoss @s.molinari last edited by amoss

          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:
          https://github.com/quasarframework/quasar/issues/2070#issuecomment-416501972

          metalsadman 1 Reply Last reply Reply Quote 0
          • metalsadman
            metalsadman @amoss last edited by

            @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.

            1 Reply Last reply Reply Quote 0
            • A
              amoss last edited by

              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?
              Thanks

              metalsadman 1 Reply Last reply Reply Quote 0
              • metalsadman
                metalsadman @amoss last edited by

                @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 :/.

                1 Reply Last reply Reply Quote 0
                • A
                  amoss last edited by

                  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.
                  Thanks

                  metalsadman 1 Reply Last reply Reply Quote 0
                  • metalsadman
                    metalsadman @amoss last edited by

                    @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.

                    A 1 Reply Last reply Reply Quote 0
                    • A
                      amoss @metalsadman last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • A
                        amoss last edited by

                        👍

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post