q-datetime always with one day difference

  • My API delivers the date 2018-01-31, but in the <q-datetime v-model="myDate" type="date" /> it show 2018-01-30, day 30 instead of 31, why?

    I assume its because the timezone, so how i disable anything related to timezone? I just wanna show the same date inside the component 🙂

  • Hello,

    I have same issue. It’s a problem of timezone. the component q-datetime seems to use timezone of browser… When i set a date ‘2018-07-31 17:45’, q-datetime shows ‘2018-07-31 21:45’ (my timezone is gmt+4).

    But I don’t want that q-datetime use my timezone, I want just to show the really date (2018-07-31 17:45)

    Do you have resolved your problem ?


  • Convert the time you want to use to UTC first.

  • @Hawkeye64, my date is already in UTC but q-datetime convert it in local time

  • If you use momentjs, maybe something like this will work:

    let timestamp = moment(origTime)
    return timestamp.utcOffset(offset, false).format('YYYY-MM-DD HH:mm:ss')

    Where offset looks like this: '-04:00:00', which if you are using interval in postgreSQL, you can get it via interval_column_name::text in your query.

    I use this myself in a condition where I show timstamps for an event. In the UI I show browser (local) time and one shows site time - relevant to the browser time, where site is when the event occurred at the location and I keep a tz_offset (postgres interval) if the timezone. If the local time is 2018-07-19 06:00:00 then the site time shows 2018-07-19 04:00:00, if there is a 2 hour time zone difference.

    Not sure if it’ll help your particular circumstance, but it’s something to look into if you haven’t already.

Log in to reply