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

    QDate formatting to something other than YYYY/MM/DD?

    Help
    3
    4
    4334
    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.
    • D
      daveline last edited by daveline

      Just curious if it possible in Quasar 1 for QDate with QInput to display formatting to something other than YYYY/MM/DD. My users prefer to see their dates in MM/DD/YYYY format.

      1 Reply Last reply Reply Quote 1
      • E
        Eelke last edited by

        Mine prefer DD/MM/YYYY

        I made a ugly wrapper-component, but I think it can be done much easier. Can’t find how though…

        The component:

        <template>
        <q-input :value=“computedDatum” :readonly=“readOnly” @focus=“verplaatsFocus” :label=“label”>
        <template v-slot:append>
        <q-icon name=“event” class=“cursor-pointer”>
        <q-popup-proxy ref=“qDateProxy” @show=“readOnly = true” @hide=“readOnly = false”>
        <q-date v-model=“displayValue” minimal @input="$refs.qDateProxy.hide()"/>
        </q-popup-proxy>
        </q-icon>
        </template>
        </q-input>
        </template>

        <script>
        import { date } from ‘quasar’

        export default {
        props: [
        ‘label’,
        ‘value’
        ],
        data: () => ({
        readOnly: false
        }),
        computed: {
        computedDatum: {
        get: function () {
        return this.formatteerDatum(this.displayValue)
        },
        set: function () {
        this.displayValue = null
        }
        },
        displayValue: {
        get: function () {
        return date.formatDate(this.value, ‘YYYY/MM/DD’)
        },
        set: function (modifiedValue) {
        this.$emit(‘input’, modifiedValue)
        }
        }
        },
        methods: {
        verplaatsFocus () {
        document.activeElement.blur()
        this.$refs.qDateProxy.show()
        },
        formatteerDatum (x) {
        return date.formatDate(x, ‘DD/MM/YYYY’)
        }
        }
        }
        </script>

        D 1 Reply Last reply Reply Quote 0
        • D
          daveline @Eelke last edited by

          @eelke Perfect thanks!

          1 Reply Last reply Reply Quote 0
          • J
            jubalj last edited by

            Same issue, just curious if there is a better solution in the current quasar version?

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