Skip to content

Commit

Permalink
Moving function declaration out of conditional statement. It breaks s…
Browse files Browse the repository at this point in the history
…trict mode. (#103)

Fix for #101
  • Loading branch information
qodesmith authored Aug 9, 2020
1 parent a88a209 commit 73ab3d1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -609,13 +609,14 @@ function sanitizeOptions(opts) {
}
options.position = establishPosition(position || 'bl')

function dsErr(min) {
var lessOrGreater = min ? 'less' : 'greater'
throw new Error('"dateSelected" in options is ' + lessOrGreater + ' than "' + (min || 'max') + 'Date".')
}

// Check proper relationship between `minDate`, `maxDate`, & `dateSelected`.
if (maxDate < minDate) throw new Error('"maxDate" in options is less than "minDate".')
if (dateSelected) {
function dsErr(min) {
var lessOrGreater = min ? 'less' : 'greater'
throw new Error('"dateSelected" in options is ' + lessOrGreater + ' than "' + (min || 'max') + 'Date".')
}
if (minDate > dateSelected) dsErr('min')
if (maxDate < dateSelected) dsErr()
}
Expand Down

0 comments on commit 73ab3d1

Please sign in to comment.