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

refactor: Added support for string-based property values for date based components #1470

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

rkaraivanov
Copy link
Member

This commit adds support for passing in string based date values to date-bound properties of calendar, date-time input and date picker components. The component will now try to parse the passed in value without directly throwing an exception.
Unified the type declarations between date-bound component.

Closes #1467

…ed components

This commit adds support for passing in string based date values
to date-bound properties of calendar, date-time input and date picker components.
The component will now try to parse the passed in value without directly
throwing an exception.
Unified the type declarations between date-bound component.
src/components/calendar/calendar.interaction.spec.ts Outdated Show resolved Hide resolved
src/components/calendar/types.ts Outdated Show resolved Hide resolved
src/components/calendar/helpers.ts Outdated Show resolved Hide resolved
src/components/calendar/helpers.ts Outdated Show resolved Hide resolved
this._value = value;
this._setFormValue(value ? value.toISOString() : null);
@property({ converter: convertToDate })
public set value(value: Date | string | null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know only the backing field change, but just as an example from AB:
image
This will error out on strict checks and it's not restricted to just the date components. Could be a separate issue for most components by the looks of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: DatePicker throws error when the data is string
3 participants