Skip to content

Commit

Permalink
Start/End Error
Browse files Browse the repository at this point in the history
  • Loading branch information
jabbate19 committed Oct 14, 2024
1 parent 586143f commit e83ed68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/db/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ impl EventData {
if self.location.is_empty() {
errs.push("Missing Location.".to_string());
}
if self.start_time < self.end_time {
errs.push("Start date cannot be before end date.".to_string());
if self.start_time > self.end_time {
errs.push("Start date cannot be after end date.".to_string());
}
if self.end_time < Utc::now() {
errs.push("Event cannot be in the past.".to_string())
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export function validateEvent(title: string, location: string, start: string, en
if (title.length == 0 || location.length == 0 || start.length == 0 || end.length == 0) {
out.push('Please fill in all fields.');
}
if (new Date(start) < new Date(end)) {
out.push('Start date cannot be before end.');
if (new Date(start) > new Date(end)) {
out.push('Start date cannot be after end.');
}
if (new Date(end) < new Date()) {
out.push('Event cannot be in the past.');
Expand Down

0 comments on commit e83ed68

Please sign in to comment.