Skip to content

Commit

Permalink
v3.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0n authored May 26, 2024
1 parent 071e9a4 commit d182c0a
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

### v3.5.3
* fixed range mode [#613](https://github.com/t1m0n/air-datepicker/issues/613)

### v3.5.2
* fixed range mode [#613](https://github.com/t1m0n/air-datepicker/issues/613)

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ new AirDatepicker('#el' [, options]);

## Recent updates

### v3.5.3
* fixed range mode [#613](https://github.com/t1m0n/air-datepicker/issues/613)

### v3.5.2
* fixed range mode [#613](https://github.com/t1m0n/air-datepicker/issues/613)

Expand Down
3 changes: 3 additions & 0 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ new AirDatepicker('#el' [, options]);

## Recent updates

### v3.5.3
* fixed range mode [#613](https://github.com/t1m0n/air-datepicker/issues/613)

### v3.5.2
* fixed range mode [#613](https://github.com/t1m0n/air-datepicker/issues/613)

Expand Down
2 changes: 1 addition & 1 deletion dist/air-datepicker.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/air-datepicker.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "air-datepicker",
"version": "3.5.2",
"version": "3.5.3",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack",
"dev:serve": "cross-env NODE_ENV=development webpack serve",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "air-datepicker",
"version": "3.5.2",
"version": "3.5.3",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack",
"dev:serve": "cross-env NODE_ENV=development webpack serve",
Expand Down
3 changes: 2 additions & 1 deletion src/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let $datepickersContainer = '',

export default class Datepicker {
static defaults = defaults
static version = '3.5.2'
static version = '3.5.3'
static defaultGlobalContainerId = 'air-datepicker-global-container'
static buildGlobalContainer(id) {
containerBuilt = true;
Expand Down Expand Up @@ -589,6 +589,7 @@ export default class Datepicker {
// Assume that if unselectDate has been called, then there is only one selected date
// in range mode, so we need to reset rangeDateTo
_this.rangeDateTo = '';
_this.rangeDateFrom = selected[0];

_this._updateLastSelectedDate(_this.selectedDates[_this.selectedDates.length - 1]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/datepickerCell.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
background: var(--adp-cell-background-color-in-range);
border-radius: 0;

&:hover {
&:hover, &.-focus- {
background: var(--adp-cell-background-color-in-range-hover);
}
}
Expand Down
48 changes: 47 additions & 1 deletion tests/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ describe('OPTIONS TESTS', () => {
expect(timeFormat.format(dp.selectedDates[1])).toEqual('20:20');
});

it('should work correctly when user unselects one date and then selects another', () => {
it('should work correctly when user unselects "to" date and then selects other', () => {
init({
range: true,
toggleSelected: true,
Expand All @@ -851,5 +851,51 @@ describe('OPTIONS TESTS', () => {
expect(dp.selectedDates[1].toLocaleDateString('ru')).toEqual('23.05.2024');

});

it('should work correctly when user unselects "from" date and then selects another', () => {
init({
range: true,
toggleSelected: true,
startDate: '2024-05-26',
});

// Select two dates
dp.getCell('2024-05-12').click();
dp.getCell('2024-05-17').click();

// Unselect the last one
dp.getCell('2024-05-12').click();

// Select other 'to' date
dp.getCell('2024-05-01').click();

expect(dp.selectedDates).toHaveLength(2);
expect(dp.selectedDates[0].toLocaleDateString('ru')).toEqual('01.05.2024');
expect(dp.selectedDates[1].toLocaleDateString('ru')).toEqual('17.05.2024');

});

it('should work correctly when user unselects "to" date and then selects other date erlier than "from"', () => {
init({
range: true,
toggleSelected: true,
startDate: '2024-05-26',
});

// Select two dates
dp.getCell('2024-05-12').click();
dp.getCell('2024-05-17').click();

// Unselect the last one
dp.getCell('2024-05-17').click();

// Select other 'to' date
dp.getCell('2024-05-01').click();

expect(dp.selectedDates).toHaveLength(2);
expect(dp.selectedDates[0].toLocaleDateString('ru')).toEqual('01.05.2024');
expect(dp.selectedDates[1].toLocaleDateString('ru')).toEqual('12.05.2024');

});
});
});

0 comments on commit d182c0a

Please sign in to comment.