tempus-dominus
tempus-dominus copied to clipboard
Error when trying to change AM/PM before selecting a time
Prerequisites
- [X] I have searched for duplicate or closed issues.
- [X] I have validated my setup against the latest version on StackBlitz.
- [X] I have read the contributing guidelines.
- [X] 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