Skip to content

Commit

Permalink
Merge branch 'add-date-picker' of https://github.com/ministryofjustic…
Browse files Browse the repository at this point in the history
…e/moj-frontend into add-date-picker
  • Loading branch information
helennickols committed Jul 31, 2024
2 parents 9003aa3 + c886536 commit 3bdbfb0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/examples/date-picker-error/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
layout: layouts/example.njk
title: Date Picker (example)
arguments: date-picker
figma_link: https://www.figma.com/design/N2xqOFkyehXwcD9DxU1gEq/MoJ-Figma-Kit?node-id=792-861&t=6DfPOX7RAnjrVE0j-0
---

{%- from "moj/components/date-picker/macro.njk" import mojDatePicker -%}
Expand Down
1 change: 1 addition & 0 deletions docs/examples/date-picker-excluded-dates/index.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: layouts/example.njk
title: Date Picker Excluded Dates (example)
figma_link: https://www.figma.com/design/N2xqOFkyehXwcD9DxU1gEq/MoJ-Figma-Kit?node-id=792-861&t=6DfPOX7RAnjrVE0j-0
---

{%- from "moj/components/date-picker/macro.njk" import mojDatePicker -%}
Expand Down
1 change: 1 addition & 0 deletions docs/examples/date-picker-excluded-days/index.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: layouts/example.njk
title: Date Picker Excluded Days (example)
figma_link: https://www.figma.com/design/N2xqOFkyehXwcD9DxU1gEq/MoJ-Figma-Kit?node-id=792-861&t=6DfPOX7RAnjrVE0j-0
---

{%- from "moj/components/date-picker/macro.njk" import mojDatePicker -%}
Expand Down
1 change: 1 addition & 0 deletions docs/examples/date-picker-min-max/index.njk
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
layout: layouts/example.njk
title: Date Picker Min and Max Date (example)
figma_link: https://www.figma.com/design/N2xqOFkyehXwcD9DxU1gEq/MoJ-Figma-Kit?node-id=792-861&t=6DfPOX7RAnjrVE0j-0
---

{%- from "moj/components/date-picker/macro.njk" import mojDatePicker -%}
Expand Down
3 changes: 1 addition & 2 deletions src/moj/components/date-picker/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Date picker

- [Guidance](https://design-patterns.service.justice.gov.uk/components/date-picker
picker)
- [Guidance](https://design-patterns.service.justice.gov.uk/components/date-picker)

## Example

Expand Down
6 changes: 3 additions & 3 deletions src/moj/components/date-picker/date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Datepicker.prototype.createDialog = function () {
const $dialog = document.createElement("div");

$dialog.id = this.id;
$dialog.setAttribute("class", "moj-datepicker__dialog datepickerDialog");
$dialog.setAttribute("class", "moj-datepicker__dialog");
$dialog.setAttribute("role", "dialog");
$dialog.setAttribute("aria-modal", "true");
$dialog.setAttribute("aria-labelledby", titleId);
Expand Down Expand Up @@ -337,7 +337,7 @@ Datepicker.prototype.setOptions = function () {
Datepicker.prototype.setMinAndMaxDatesOnCalendar = function () {
if (this.config.minDate) {
this.minDate = this.formattedDateFromString(
this.$module.dataset.mindate,
this.config.minDate,
null,
);
if (this.minDate && this.currentDate < this.minDate) {
Expand All @@ -347,7 +347,7 @@ Datepicker.prototype.setMinAndMaxDatesOnCalendar = function () {

if (this.config.maxDate) {
this.maxDate = this.formattedDateFromString(
this.$module.dataset.maxdate,
this.config.maxDate,
null,
);
if (this.maxDate && this.currentDate > this.maxDate) {
Expand Down

0 comments on commit 3bdbfb0

Please sign in to comment.