What happened?
The getMaxDate and getMinDate utilities return a numeric timestamp instead of a Date object.
This leads to runtime errors when using Date methods directly:
const result = date.getMaxDate(d1, d2)
console.log(typeof result) // number
console.log(result instanceof Date) // false
result.getFullYear() // TypeError
What did you expect to happen?
The function should return a Date object, consistent with other date utilities in Quasar.
Reproduction URL
https://codepen.io/KundanAIE/pen/zxKEZGR
How to reproduce?
- Open the reproduction link
- Run the code
- Observe that:
- The returned value is a number
instanceof Date is false
- Calling
getFullYear() throws a TypeError
Flavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Composables (quasar)
Platforms/Browsers
Chrome
Quasar info output
Relevant log output
Additional context
Root cause:
Math.max() and Math.min() convert Date objects to timestamps and return a number.
Suggested fix:
Wrap the return value in new Date(...) to maintain consistency.
What happened?
The
getMaxDateandgetMinDateutilities return a numeric timestamp instead of aDateobject.This leads to runtime errors when using Date methods directly:
What did you expect to happen?
The function should return a
Dateobject, consistent with other date utilities in Quasar.Reproduction URL
https://codepen.io/KundanAIE/pen/zxKEZGR
How to reproduce?
instanceof Dateis falsegetFullYear()throws a TypeErrorFlavour
Quasar CLI with Vite (@quasar/cli | @quasar/app-vite)
Areas
Composables (quasar)
Platforms/Browsers
Chrome
Quasar info output
Relevant log output
Additional context
Root cause:
Math.max()andMath.min()convert Date objects to timestamps and return a number.Suggested fix:
Wrap the return value in
new Date(...)to maintain consistency.