Skip to content

Commit

Permalink
[FIX] Adding error message for wrong dates (#21677)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Aleman <kaleman960@gmail.com>
Co-authored-by: Guilherme Gazzo <guilhermegazzo@gmail.com>
  • Loading branch information
3 people authored and MartinSchoeler committed Nov 28, 2022
1 parent fd65c34 commit 7cd00ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/meteor/app/api/server/v1/rooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,10 @@ API.v1.addRoute(
dateTo = new Date(dateTo);
dateTo.setDate(dateTo.getDate() + 1);

if (dateFrom > dateTo) {
throw new Meteor.Error('error-invalid-dates', 'From date cannot be after To date');
}

sendFile(
{
rid,
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1881,6 +1881,7 @@
"error-invalid-custom-field-name": "Invalid custom field name. Use only letters, numbers, hyphens and underscores.",
"error-invalid-custom-field-value": "Invalid value for __field__ field",
"error-invalid-date": "Invalid date provided.",
"error-invalid-dates":"From date cannot be after To date",
"error-invalid-description": "Invalid description",
"error-invalid-domain": "Invalid domain",
"error-invalid-email": "Invalid email __email__",
Expand Down

0 comments on commit 7cd00ea

Please sign in to comment.