Skip to content

Commit be6d438

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/embroider/addon-shim-1.8.7
2 parents 59d1274 + b0c470b commit be6d438

File tree

6 files changed

+73
-79
lines changed

6 files changed

+73
-79
lines changed

.release-plan.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"solution": {
3+
"ember-pikaday": {
4+
"impact": "minor",
5+
"oldVersion": "4.0.0",
6+
"newVersion": "4.1.0",
7+
"constraints": [
8+
{
9+
"impact": "minor",
10+
"reason": "Appears in changelog section :rocket: Enhancement"
11+
},
12+
{
13+
"impact": "patch",
14+
"reason": "Appears in changelog section :bug: Bug Fix"
15+
},
16+
{
17+
"impact": "patch",
18+
"reason": "Appears in changelog section :memo: Documentation"
19+
},
20+
{
21+
"impact": "patch",
22+
"reason": "Appears in changelog section :house: Internal"
23+
}
24+
],
25+
"pkgJSONPath": "./package.json"
26+
}
27+
},
28+
"description": "## Release (2024-01-29)\n\nember-pikaday 4.1.0 (minor)\n\n#### :rocket: Enhancement\n* `ember-pikaday`\n * [#535](https://github.com/adopted-ember-addons/ember-pikaday/pull/535) feat: add new `register` attr to access pikaday instance, moment instance replaceable ([@betocantu93](https://github.com/betocantu93))\n\n#### :bug: Bug Fix\n* `ember-pikaday`\n * [#569](https://github.com/adopted-ember-addons/ember-pikaday/pull/569) Bug: updated tests ([@MelSumner](https://github.com/MelSumner))\n * [#540](https://github.com/adopted-ember-addons/ember-pikaday/pull/540) fix(modifier): ensure compatibility with ember-modifier v4 ([@anehx](https://github.com/anehx))\n\n#### :memo: Documentation\n* `ember-pikaday`\n * [#534](https://github.com/adopted-ember-addons/ember-pikaday/pull/534) fix(docs): simpler localization of datepicker ([@czosel](https://github.com/czosel))\n\n#### :house: Internal\n* `ember-pikaday`\n * [#580](https://github.com/adopted-ember-addons/ember-pikaday/pull/580) Resolve failing test scenarios ([@MelSumner](https://github.com/MelSumner))\n * [#578](https://github.com/adopted-ember-addons/ember-pikaday/pull/578) setup release-plan ([@mansona](https://github.com/mansona))\n * [#576](https://github.com/adopted-ember-addons/ember-pikaday/pull/576) use pnpm ([@mansona](https://github.com/mansona))\n\n#### Committers: 5\n- Alberto Cantú Gómez ([@betocantu93](https://github.com/betocantu93))\n- Chris Manson ([@mansona](https://github.com/mansona))\n- Christian Zosel ([@czosel](https://github.com/czosel))\n- Jonas Metzener ([@anehx](https://github.com/anehx))\n- Melanie Sumner ([@MelSumner](https://github.com/MelSumner))\n"
29+
}

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,33 @@
11
# Changelog
2+
## Release (2024-01-29)
3+
4+
ember-pikaday 4.1.0 (minor)
5+
6+
#### :rocket: Enhancement
7+
* `ember-pikaday`
8+
* [#535](https://github.com/adopted-ember-addons/ember-pikaday/pull/535) feat: add new `register` attr to access pikaday instance, moment instance replaceable ([@betocantu93](https://github.com/betocantu93))
9+
10+
#### :bug: Bug Fix
11+
* `ember-pikaday`
12+
* [#569](https://github.com/adopted-ember-addons/ember-pikaday/pull/569) Bug: updated tests ([@MelSumner](https://github.com/MelSumner))
13+
* [#540](https://github.com/adopted-ember-addons/ember-pikaday/pull/540) fix(modifier): ensure compatibility with ember-modifier v4 ([@anehx](https://github.com/anehx))
14+
15+
#### :memo: Documentation
16+
* `ember-pikaday`
17+
* [#534](https://github.com/adopted-ember-addons/ember-pikaday/pull/534) fix(docs): simpler localization of datepicker ([@czosel](https://github.com/czosel))
18+
19+
#### :house: Internal
20+
* `ember-pikaday`
21+
* [#580](https://github.com/adopted-ember-addons/ember-pikaday/pull/580) Resolve failing test scenarios ([@MelSumner](https://github.com/MelSumner))
22+
* [#578](https://github.com/adopted-ember-addons/ember-pikaday/pull/578) setup release-plan ([@mansona](https://github.com/mansona))
23+
* [#576](https://github.com/adopted-ember-addons/ember-pikaday/pull/576) use pnpm ([@mansona](https://github.com/mansona))
24+
25+
#### Committers: 5
26+
- Alberto Cantú Gómez ([@betocantu93](https://github.com/betocantu93))
27+
- Chris Manson ([@mansona](https://github.com/mansona))
28+
- Christian Zosel ([@czosel](https://github.com/czosel))
29+
- Jonas Metzener ([@anehx](https://github.com/anehx))
30+
- Melanie Sumner ([@MelSumner](https://github.com/MelSumner))
231

332
## v4.0.0 (2022-02-02)
433

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ All other named arguments are passed directly to Pikaday, so see [Pikaday's conf
5959

6060
The only behaviors this modifier adds to the stock Pikaday are:
6161

62-
- if you set `minDate` or `maxDate` and that causes `value` to be outside the legal range, we adjust `value` and fire `onSelect` to inform you of the change
6362
- if you set your `<input>` element's `disabled` attribute we will close Pikaday if it had been open.
6463

6564
### &lt;PikadayInput&gt; Component

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ember-pikaday",
3-
"version": "4.0.0",
3+
"version": "4.1.0",
44
"description": "A tested datepicker component for Ember CLI projects including test helpers for your own acceptance tests.",
55
"keywords": [
66
"datepicker",

src/modifiers/pikaday.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,9 @@ export default class PikadayModifier extends Modifier {
5454
this.#observer.observe(element, { attributes: true });
5555
register?.(this.#pikaday);
5656
} else {
57-
let { value, minDate, maxDate } = named;
58-
let valueAltered = false;
59-
this.#pikaday.setMinDate(copyDate(minDate));
60-
if (minDate && value && value < minDate) {
61-
value = minDate;
62-
valueAltered = true;
63-
}
64-
65-
this.#pikaday.setMaxDate(copyDate(maxDate));
66-
if (maxDate && value && value > maxDate) {
67-
value = maxDate;
68-
valueAltered = true;
69-
}
57+
let { value } = named;
7058

71-
this.#pikaday.setDate(value, !valueAltered);
59+
this.#pikaday.setDate(value, true);
7260
this.#pikaday.config(pikadayOptions);
7361
}
7462
}
@@ -79,12 +67,3 @@ export default class PikadayModifier extends Modifier {
7967
}
8068
}
8169
}
82-
83-
// apparently Pikaday mutates Dates that you pass it for minDate and maxDate. <sigh>
84-
function copyDate(date) {
85-
if (date) {
86-
return new Date(date.getTime());
87-
} else {
88-
return date;
89-
}
90-
}

test-app/tests/integration/components/pikaday-input-test.js

Lines changed: 12 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,12 @@ module('Integration | Component | pikaday-input', function (hooks) {
253253
this.set('tomorrow', new Date(2010, 7, 9));
254254
await settled();
255255

256-
assert.dom('input').hasValue('09.08.2010');
256+
assert
257+
.dom('input')
258+
.hasValue(
259+
'10.08.2010',
260+
'we do not manipulate the value even if it violates minDate'
261+
);
257262
});
258263

259264
test('set new date value with a new max date', async function (assert) {
@@ -267,7 +272,12 @@ module('Integration | Component | pikaday-input', function (hooks) {
267272
this.set('tomorrow', new Date(2010, 7, 11));
268273
await settled();
269274

270-
assert.dom('input').hasValue('11.08.2010');
275+
assert
276+
.dom('input')
277+
.hasValue(
278+
'10.08.2010',
279+
'we do not manipulate the value, even if it violates the maxDate'
280+
);
271281
});
272282

273283
test('theme option adds theme as CSS class to DOM element', async function (assert) {
@@ -592,58 +602,6 @@ module('Integration | Component | pikaday-input', function (hooks) {
592602
assert.dom(disabledWeekendCell).doesNotHaveClass('is-disabled');
593603
});
594604

595-
test("if minDate is greater than value we set pikaday's current date to minDate", async function (assert) {
596-
assert.expect(1);
597-
598-
const today = new Date();
599-
const tomorrow = new Date(Date.now() + 60 * 60 * 24 * 1000);
600-
601-
this.set('currentDate', today);
602-
this.set('minDate', today);
603-
this.set('updateCurrentDate', (date) => {
604-
this.set('currentDate', date);
605-
});
606-
607-
await render(hbs`
608-
<PikadayInput @minDate={{this.minDate}} @value={{this.currentDate}} @onSelection={{this.updateCurrentDate}}/>
609-
`);
610-
611-
this.set('minDate', tomorrow);
612-
await settled();
613-
614-
assert.equal(
615-
this.currentDate.getDate(),
616-
tomorrow.getDate(),
617-
'value should change'
618-
);
619-
});
620-
621-
test("if maxDate is lower than value we set pikaday's current date to maxDate", async function (assert) {
622-
assert.expect(1);
623-
624-
const today = new Date();
625-
const tomorrow = new Date(Date.now() + 60 * 60 * 24 * 1000);
626-
627-
this.set('currentDate', tomorrow);
628-
this.set('maxDate', tomorrow);
629-
this.set('updateCurrentDate', (date) => {
630-
this.set('currentDate', date);
631-
});
632-
633-
await render(hbs`
634-
<PikadayInput @maxDate={{this.maxDate}} @value={{this.currentDate}} @onSelection={{this.updateCurrentDate}}/>
635-
`);
636-
637-
this.set('maxDate', today);
638-
await settled();
639-
640-
assert.equal(
641-
this.currentDate.getDate(),
642-
today.getDate(),
643-
'value should change'
644-
);
645-
});
646-
647605
test("if value is null we don't enforce minDate or maxDate", async function (assert) {
648606
assert.expect(1);
649607

0 commit comments

Comments
 (0)