Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to change AM/PM before selecting a time #2908

Open
4 tasks done
scoldwell opened this issue May 16, 2024 · 1 comment
Open
4 tasks done

Error when trying to change AM/PM before selecting a time #2908

scoldwell opened this issue May 16, 2024 · 1 comment
Labels
State: Triage Tickets that need to be triaged. Type: Bug

Comments

@scoldwell
Copy link

scoldwell commented May 16, 2024

Prerequisites

  • I have searched for duplicate or closed issues.
  • I have validated my setup against the latest version on StackBlitz.
  • I have read the contributing guidelines.
  • I understand that only sponsored issues will be worked on and that if I wish to sponsor an issue, I will contact the owner FIRST.

Describe the issue

When using tempus dominus to collect a time only with the useCurrent option set to false, if the user tries to change the AM/PM before choosing a time the following error is thrown:

actions.ts:116 Uncaught TypeError: Cannot read properties of undefined (reading 'hours')
    at Actions.do (actions.ts:116:33)
    at actions.ts:31:14
    at event-emitter.ts:21:7
    at Array.forEach (<anonymous>)
    at EventEmitter.emit (event-emitter.ts:20:22)
    at Display._actionsClickEvent (index.ts:806:32)

This is coming from the following case block (this.dates.lastPicked is undefined):

    case ActionTypes.toggleMeridiem:
        this.manipulateAndSet(
          lastPicked,
          Unit.hours,
          this.dates.lastPicked.hours >= 12 ? -12 : 12
        );
        break;

StackBlitz fork

https://tempus-dominus-v6-simple-setup-y31bad.stackblitz.io

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome

What version of are you using? You can find this information from the sample StackBlitz.

6.9.7

What your browser's locale? You can find this information from the sample StackBlitz.

en-US

@scoldwell scoldwell added State: Triage Tickets that need to be triaged. Type: Bug labels May 16, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Tempus Dominus May 16, 2024
@scoldwell
Copy link
Author

I would be happy to fix this and submit a PR, but I'm not sure of the correct solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
State: Triage Tickets that need to be triaged. Type: Bug
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant