don't wrap null dates in moments

fixes CNVS-25102

test-plan:
 - go to create a new appointment group
 - enter just the date; should not get an error about start needing to
   be before end
 - enter just the date and start (no end); same
 - enter just the date and end (no start); same
 - enter a date and start and end, with start before end; no error
 - enter a date and start and end, with start after end; should get the
   error

Change-Id: I8ab3fddeef5d765f15c75e7f489201ea03e07714
Reviewed-on: https://gerrit.instructure.com/67325
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
This commit is contained in:
Jacob Fugal 2015-11-17 13:10:20 -07:00 committed by Matt Fairbourn
parent 62847b535b
commit eb3f0661a4
2 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@ define [
# expects a date (unfudged), and returns a fullcalendar moment # expects a date (unfudged), and returns a fullcalendar moment
# (fudged) appropriate for passing to fullcalendar methods # (fudged) appropriate for passing to fullcalendar methods
wrap = (date) -> wrap = (date) ->
return null unless date
$.fullCalendar.moment($.fudgeDateForProfileTimezone(date)) $.fullCalendar.moment($.fudgeDateForProfileTimezone(date))
# expects a fullcalendar moment (fudged) from a fullcalendar # expects a fullcalendar moment (fudged) from a fullcalendar

View File

@ -92,6 +92,10 @@ define [
me = new TimeBlockRow(@timeBlockList) me = new TimeBlockRow(@timeBlockList)
ok me.validate() ok me.validate()
test 'valid if incomplete', ->
me = new TimeBlockRow(@timeBlockList, start: @start, end: null)
ok me.validate()
test 'getData', -> test 'getData', ->
me = new TimeBlockRow(@timeBlockList, {@start, @end}) me = new TimeBlockRow(@timeBlockList, {@start, @end})
me.validate() me.validate()