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

DRAFT: Updates DD to dd and YYYY to yyyy to fix error from date-fns/format #671

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
2 changes: 1 addition & 1 deletion docs/pages/kdaterange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
[validationConstants.START_DATE_AFTER_END_DATE]: 'Start date cannot be after end date',
[validationConstants.FUTURE_DATE]: 'Cannot select a future date',
[validationConstants.DATE_BEFORE_FIRST_ALLOWED]:
'Date must be after ' + format(this.firstAllowedDate, 'DD/MM/YYYY'),
'Date must be after ' + format(this.firstAllowedDate, 'dd/MM/yyyy'),
};
},
},
Expand Down
14 changes: 7 additions & 7 deletions lib/KDateRange/KDateCalendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@
var currDate = this.getDate(key, result);
return (
(this.selectedStartDate &&
format(this.selectedStartDate, 'DD/MM/YYYY') === format(currDate, 'DD/MM/YYYY')) ||
format(this.selectedStartDate, 'dd/MM/yyyy') === format(currDate, 'dd/MM/yyyy')) ||
(this.selectedEndDate &&
format(this.selectedEndDate, 'DD/MM/YYYY') === format(currDate, 'DD/MM/YYYY'))
format(this.selectedEndDate, 'dd/MM/yyyy') === format(currDate, 'dd/MM/yyyy'))
);
},
/**
Expand All @@ -282,18 +282,18 @@
this.isValidDate(this.selectedStartDate) &&
this.isValidDate(this.selectedEndDate) &&
isAfter(this.selectedEndDate, this.selectedStartDate) &&
format(this.selectedStartDate, 'DD/MM/YYYY') !==
format(this.selectedEndDate, 'DD/MM/YYYY')
format(this.selectedStartDate, 'dd/MM/yyyy') !==
format(this.selectedEndDate, 'dd/MM/yyyy')
) {
if (
this.selectedStartDate &&
format(this.selectedStartDate, 'DD/MM/YYYY') === format(currDate, 'DD/MM/YYYY') &&
format(this.selectedStartDate, 'dd/MM/yyyy') === format(currDate, 'dd/MM/yyyy') &&
!(dayInWeekIndex === 7)
) {
return 'first';
} else if (
this.selectedEndDate &&
format(this.selectedEndDate, 'DD/MM/YYYY') === format(currDate, 'DD/MM/YYYY') &&
format(this.selectedEndDate, 'dd/MM/yyyy') === format(currDate, 'dd/MM/yyyy') &&
!(dayInWeekIndex === 1) &&
!(result === 1)
) {
Expand Down Expand Up @@ -469,4 +469,4 @@
border-bottom-right-radius: 60px;
}

</style>
</style>
8 changes: 4 additions & 4 deletions lib/KDateRange/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@
data() {
return {
dateRange: {
start: this.defaultStartDate ? format(this.defaultStartDate, 'YYYY-MM-DD') : null,
start: this.defaultStartDate ? format(this.defaultStartDate, 'yyyy-MM-dd') : null,
end:
this.defaultStartDate && this.defaultEndDate
? format(this.defaultEndDate, 'YYYY-MM-DD')
? format(this.defaultEndDate, 'yyyy-MM-dd')
: null,
},
modalSize: 480,
Expand Down Expand Up @@ -259,7 +259,7 @@
if (!date) {
return null;
}
return format(date, 'YYYY-MM-DD');
return format(date, 'yyyy-MM-dd');
},
/** Returns startDateInvalid message from validation machine */
invalidStart() {
Expand Down Expand Up @@ -333,4 +333,4 @@
width: 49%;
}

</style>
</style>
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"aphrodite": "https://github.com/learningequality/aphrodite/",
"autosize": "3.0.21",
"css-element-queries": "1.2.0",
"date-fns": "1.30.1",
"date-fns": "^3.6.0",
"frame-throttle": "3.0.0",
"fuzzysearch": "1.0.3",
"lodash": "4.17.21",
Expand Down Expand Up @@ -81,5 +81,8 @@
},
"browserslist": [
"extends browserslist-config-kolibri"
]
],
"volta": {
"node": "10.24.1"
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4759,10 +4759,10 @@ data-urls@^2.0.0:
whatwg-mimetype "^2.3.0"
whatwg-url "^8.0.0"

date-fns@1.30.1:
version "1.30.1"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
date-fns@^3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-3.6.0.tgz#f20ca4fe94f8b754951b24240676e8618c0206bf"
integrity sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==

date-now@^0.1.4:
version "0.1.4"
Expand Down
Loading