Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Fixed
- Parse non ISO based date formats when binding to a date attribute in components [#1587](https://github.com/IgniteUI/igniteui-webcomponents/issues/1587)

## [5.3.0] - 2025-03-13
### Added
- Tile manager component [#1402](https://github.com/IgniteUI/igniteui-webcomponents/pull/1402)
Expand Down
25 changes: 25 additions & 0 deletions src/components/calendar/calendar.interaction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ describe('Calendar interactions', () => {

calendar.setAttribute('value', date.native.toISOString());
expect(date.equalTo(calendar.value!)).to.be.true;

// Non-ISO date string
calendar.setAttribute('value', date.native.toString());
expect(date.equalTo(calendar.value!)).to.be.true;
});

it('setting `value` - string property binding', async () => {
Expand All @@ -52,6 +56,10 @@ describe('Calendar interactions', () => {

expect(date.equalTo(calendar.value!)).to.be.true;

// Non-ISO date string
calendar.value = date.native.toString();
expect(date.equalTo(calendar.value!)).to.be.true;

// Invalid date
for (const each of [new Date('s'), '', null, undefined]) {
calendar.value = each;
Expand All @@ -72,6 +80,16 @@ describe('Calendar interactions', () => {
expect(calendar.values).lengthOf(2);
expect(date_1.equalTo(first(calendar.values))).to.be.true;
expect(date_2.equalTo(last(calendar.values))).to.be.true;

// Non-ISO date format
calendar.setAttribute(
'values',
`${date_1.native.toString()}, ${date_2.native.toString()}`
);

expect(calendar.values).lengthOf(2);
expect(date_1.equalTo(first(calendar.values))).to.be.true;
expect(date_2.equalTo(last(calendar.values))).to.be.true;
});

it('setting `values` - string property binding', async () => {
Expand All @@ -88,6 +106,13 @@ describe('Calendar interactions', () => {
expect(date_1.equalTo(first(calendar.values))).to.be.true;
expect(date_2.equalTo(last(calendar.values))).to.be.true;

// Non-ISO date formats
calendar.values = `${date_1.toString()}, ${date_2.toString()}`;

expect(calendar.values).lengthOf(2);
expect(date_1.equalTo(first(calendar.values))).to.be.true;
expect(date_2.equalTo(last(calendar.values))).to.be.true;

// Valid date combinations
const validDates = [
[date_1_str, date_2_str],
Expand Down
2 changes: 1 addition & 1 deletion src/components/calendar/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function parseISODate(string: string) {
return isValidDate(new Date(`${date}T${string}`));
}

return null;
return isValidDate(new Date(Date.parse(string)));
}

/**
Expand Down