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-datetime always with one day difference

    Help
    3
    5
    1069
    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
      andre last edited by

      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 🙂

      1 Reply Last reply Reply Quote 1
      • M
        mikaelvigneron last edited by

        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 ?

        Thanks

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

          Convert the time you want to use to UTC first.

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

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

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

              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.

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