Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

max-datetime set to midnight fails (midnight = 0) #215

@EddyTheDove

Description

@EddyTheDove

Versions

  • vue: 3.0.1
  • vue-datetime: 1.0.0-beta.11
  • luxon: 1.22.0

Description:

max-datetime set to midnight fails

Steps To Reproduce:

  • Have 2 datetime inputs (start & end)
  • Set first dates
  • max-datetime for second datetime input computes to start + x hours
  • Make sure max-datetime falls at midnight + extra minutes
  • Click on end input
    Expect result: max-datetime should be midnight tonight
    Actual result: max-datetime is midnight the following day

Sample data
start = 2020-04-23 08:30
maxGap = 480 // minutes

Proposed solution

util.js L55

export function timeComponentIsDisabled (min, max, component) {
  return (min !== null && component < min) ||
         (max !== null && component > max)
}

Cause

Midnight is set as 0 therefore doing (max && component > max) fails because max = 0 which is interpreted as false

Sorry guys, I'm on a deadline, so no time to make a pull request and wait for it to be merged.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions