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

    Show only available dates. QDatetime feature request.

    Framework
    4
    12
    2094
    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.
    • M
      morlz last edited by

      I have an array of dates among which I need to make a choice.
      The interval of dates does not suit me.

      ps Thanks for a good framework!

      1 Reply Last reply Reply Quote 0
      • Hawkeye64
        Hawkeye64 last edited by

        Why not just use QSelect?

        M 1 Reply Last reply Reply Quote 0
        • M
          morlz @Hawkeye64 last edited by

          @hawkeye64 I would like to see something like this:
          0_1532690646838_screenshot-localhost-8081-2018.07.27-12-03-10.png
          0_1532690659718_screenshot-localhost-8081-2018.07.27-12-02-22.png

          1 Reply Last reply Reply Quote 0
          • M
            mariaczi last edited by

            It is good idea. Post it on github issues

            1 Reply Last reply Reply Quote 0
            • Hawkeye64
              Hawkeye64 last edited by

              So, you want to pass in array of acceptable dates and then only those dates can be selected? It does sound like a good idea and I can already think of several business cases this could be used. Add the concept to github or better yet, make the adjustments yourself and add a PR.

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

                Sounds like an extension of the min & max feature. I mean, if you have a set of dates to choose from, there would also be a min and max date in that pack too. Looking at the src code, this would also need a disabled styling for the days that are non-selectable. The iOS version would be interesting to see for sure too.

                Scott

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

                  I’ve created an issue for this: https://github.com/quasarframework/quasar/issues/2372

                  And I’ve done the first steps for the Material theme: https://github.com/quasarframework/quasar/pull/2147

                  @morlz - I didn’t do the formatting you’ve suggested. I’ve used what was already available.

                  0_1533270713736_24ae1ce8-0fd8-4d9d-b6cf-336ee395c245-image.png

                  If the user hovers over a date not available, they get the disabled cursor. It looks better in real life. 😄

                  Scott

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

                    @morlz - What would be the maximum number of dates you’d need for the selection?

                    I ask, because there is discussion on the PR about not limiting the number, because with a number too high, it would cause performance issues. I’ve currently added 1000 dates as the limit. Would that suffice?

                    Scott

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

                      @s-molinari
                      I think the best option is to do a function to check the availability of the date.
                      It will be called for each date shown on the screen.

                      checkDate(date) {
                        return this.availableDates
                          .includes(this.$moment(date).format('YYYY-MM-DD'))
                      }
                      
                      <datepicker
                        :check-date="checkDate"
                        v-model="selectedDate"/>
                      
                      1 Reply Last reply Reply Quote 0
                      • s.molinari
                        s.molinari last edited by s.molinari

                        That is essentially what I’ve done in the PR. The checking is done in the QDateTimePicker and the client dev must only offer the min and max date and an array of available dates.

                        However, if you had 20K possible available dates in availableDate (a big range between min and max) and compare that number of dates times the max 31 days showing in a month, that would delay the rendering of the calendar considerably.

                        There has to be a limit to the size of the array of available dates. The question is, what size is “enough”? I think 1000 is more than enough and I was asking what you thought about the size of the limit.

                        Scott

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

                          @s-molinari 300 dates are enough.

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

                            Ok. So the current 1000 should also do. We’ll see if the PR gets approved. 🙂

                            Scott

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