cc-wit/attendance — Issue #113: Internal server error entering event
Author: theJenix
Created: 2012-01-18 16:43:42+00:00
State: open

I was getting an internal server error when entering an event's start and end time. Here is the exception trace from my local server instance:
500 CastError: Cast to date failed for value "2012-01-23 7:30PM"

at SchemaDate.cast (/Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/schema/date.js:65:9)
at /Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/document.js:340:27
at model.try (/Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/document.js:513:8)
at model.set (/Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/document.js:339:10)
at model.set (/Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/document.js:293:16)
at model.Document (/Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/document.js:45:17)
at model.Model (/Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/model.js:26:12)
at new model (/Users/thejenix/Development/gt-cc/attendance/node_modules/mongoose/lib/model.js:838:11)
at /Users/thejenix/Development/gt-cc/attendance/routes/events.js:21:25
at /Users/thejenix/Development/gt-cc/attendance/node_modules/async/lib/async.js:525:34

It appears to fail on the "PM", as 2012-01-23 7:30 works and 2012-01-23 19:30 gets me the correct date.

I can work around it by using 24 hour time, but it is very un-obvious what the error is and might trip up someone who doesn't have a local copy of the server handy.