pnp / pnp/sp-dev-fx-controls-react

DateTimeControl throws exception when value is undefined, although undefined can be expected through props

Open
#1,366 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted type:bug
Dominant language
TypeScript
Stars
433
Forks
418
Avg merge
5d 6m
Merged PRs (30d)
19

Description

Please check out the documentation to see if your question is already addressed there. This will help us ensure our documentation is up to date.

Category

[ ] Enhancement

[ x] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 3.12.0 ]

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

I am using a DateTimePicker

....

The Properties allow a value undefined, cause the type is defined as : Date | undefined

Observed Behavior

An exception occurs in Chrome:

TypeError: Cannot read properties of null (reading 'getTime')
at DateTimePicker._this.validate (DateTimePicker.js:150:1)
at invokeFunction (Async.js:310:1)....

Steps to Reproduce
  1. Create a spfx webpart project
  2. install latest version of spfx controls react
  3. return an component, which just renders the DateTimePicker with value undefined.
Expected

The component should render the picker and should not have a value.

Submission Guidelines

Delete this section after reading

  • All suggestions, questions and issues are welcome, please let us know what's on your mind.
  • Remember to include sufficient details and context.
  • If you have multiple suggestions, questions, or bugs please submit them in separate issues so we can track resolution.

Thanks!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the DateTimePicker with value={undefined} in an SPFx webpart, then inspect the validate path identified in DateTimePicker.js around the reported getTime exception. Done means the picker renders without an exception and has no value when its value prop is undefined.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.