quasarframework / quasar

Quasar Framework - Build high-performance VueJS user interfaces in record time
https://quasar.dev
MIT License
25.89k stars 3.51k forks source link

QDate today button should only set date, not time, in model #16623

Closed jhakkinen closed 11 months ago

jhakkinen commented 11 months ago

What happened?

When QDate's model includes both date and time information, clicking the today button sets the time to 00:00.

What did you expect to happen?

I expect the today button to only set the date to today's date and leave the time unchanged.

Reproduction URL

https://codepen.io/johnass/pen/gOqzwBX

How to reproduce?

  1. Go to the provided reproduction link
  2. Click on the today button in QDate
  3. The model's time component is set to 00:00
  4. Click on a different date in QDate
  5. The model's time component is set back to the original value

Flavour

Quasar CLI (@quasar/cli | @quasar/app)

Areas

Components (quasar)

Platforms/Browsers

No response

Quasar info output

Operating System - Darwin(21.6.0) - darwin/x64
NodeJs - 16.19.1

Global packages
  NPM - 8.19.3
  yarn - 1.22.19
  @quasar/cli - 2.3.0
  @quasar/icongenie - Not installed
  cordova - Not installed

Important local packages
  quasar - 1.22.10 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app - 2.2.6 -- Quasar Framework local CLI
  @quasar/extras - 1.10.6 -- Quasar Framework fonts, icons and animations
  eslint-plugin-quasar - 1.0.0 -- Official ESLint plugin for Quasar
  vue - 2.6.12 -- Reactive, component-oriented view layer for modern web interfaces.
  vue-router - 3.2.0 -- Official router for Vue.js 2
  vuex - 3.6.0 -- state management for Vue.js
  electron - Not installed
  electron-packager - Not installed
  electron-builder - Not installed
  @babel/core - 7.10.4 -- Babel compiler core.
  webpack - 4.44.2 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  webpack-dev-server - 3.11.0 -- Serves a webpack app. Updates the browser on changes.
  workbox-webpack-plugin - Not installed
  register-service-worker - 1.7.1 -- Script for registering service worker, with hooks
  typescript - 4.2.2 -- TypeScript is a language for application scale JavaScript development
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed

Quasar App Extensions
  @quasar/quasar-app-extension-testing-unit-jest - 2.2.3 -- A Quasar App Extension for running Jest tests
  @quasar/quasar-app-extension-testing-quality - 1.0.0-beta.8 -- A Quasar App Extension for Code Quality
  @quasar/quasar-app-extension-testing-security - 1.0.0-alpha.8 -- A Quasar App Extension for Application Security, using OWASP ZAP
  @quasar/quasar-app-extension-testing - 1.0.3 -- A Quasar App Extension for managing Test Harnesses
  @quasar/quasar-app-extension-qcalendar - 3.3.4 -- A Quasar App Extension for @quasar/quasar-ui-qcalendar

Relevant log output

No response

Additional context

No response

thevladisss commented 11 months ago

Hi @jhakkinen.

Seems like handler for today button simply does not consider the time which is passed to the q-date component, and simply emits date value, which virtually overwrites the entire value

function setToday () {
      const date = today.value
      const month = daysMap.value[ getMonthHash(date) ]

      if (month === void 0 || month.includes(date.day) === false) {
        addToModel(date)
      }

      setCalendarTo(date.year, date.month)
    }

This part of the code in QDate component is responsible for this glitch.

rstoenescu commented 11 months ago

Fix will be available in Quasar v2.14.1