Skip to content
This repository has been archived by the owner on Aug 14, 2018. It is now read-only.

Commit

Permalink
fix(eventscontroller): raise error in events/edit when end times are …
Browse files Browse the repository at this point in the history
…earlier than start times

returns an error if the user attempts to edit an event by making its end time earlier than its
start time

no
  • Loading branch information
Juxtaposeidon committed May 17, 2016
1 parent 2ce75da commit f11d0e4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions controllers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ module.exports = {
thisEvent.host = req.body.host
thisEvent.start = moment.tz(startString, 'DD-MMM-YYYY HH:mm:ss', res.locals.brigade.location.timezone).format('X')
thisEvent.end = moment.tz(endString, 'DD-MMM-YYYY HH:mm:ss', res.locals.brigade.location.timezone).format('X')
if (thisEvent.end < thisEvent.start) {
req.flash('errors', {msg: 'You can not have an event with an end time earlier than its start time.'})
res.redirect('/events/' + req.params.eventId + '/settings')
return
}
thisEvent.url = req.body.url
thisEvent.description = req.body.description
thisEvent.save(function (err) {
Expand Down

0 comments on commit f11d0e4

Please sign in to comment.