q-date displayed date is incorrect from service value

  • Hi

    I have a service that returns 2 dates:

    start date: 2018-05-18
    end date: 2018-05-19

    q-date shows:

    start date: 2018-05-17
    end date: 2018-05-18

    my q-date definition looks like this:
    <q-field icon=“fas fa-calendar-alt” helper=“Fecha en la que iniciará a resolver el paquete”>
    <q-datetime v-model=“paquete.finicio” type=“date” format=“YYYY-MM-DD” placeholder=“Fecha de inicio” />

    and the service value asignment like this:
    this.paquete.finicio = res.data.finicio; //date.formatDate(res.data.finicio, ‘YYYY-MM-DD’);

    anyone knows why could it be happening?

    thanks in advace…


  • Most likely a UTC/Local time issue. There is no “time” component of the date set so most likely midnight (12 am) is used. If you don’t care about the time set the time component to noon time (12 pm) and you should be set.

  • Thanks, it works adding the time part… but in my humble opinion it shouldn’tbe that way because the control type is date and is not datetime, besides the documentation says:

    “The model (variable binded to v-model) must either be empty (undefined) or a string in the form of a valid ISO 8601 datetime value, like 2016-10-24T10:40:14.674Z. It can also be a shorter derivative of this string, like 2016-10-24 or 2016-10-24T10:40. The value can also be a Unix Timestamp (including milliseconds), like 1477298414674. Last but not least, it can also be an instance of the Javascript Date Object, like new Date().”

    Thanks again…

Log in to reply