Skip to content

Commit

Permalink
endYear with only year should be considered as end of year + bug in t…
Browse files Browse the repository at this point in the history
…oday()
  • Loading branch information
paulgirard committed Oct 13, 2017
1 parent 880e78e commit c02a729
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/lib/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const pad0 = s => (s === null || s === undefined) ? null : (String(s).length ===
const isFuture = s => {
const ref = today()
const [ y, m, d ] = s.split('-')
return y > ref.y || (y === ref.y && m > ref.m) || (y === ref.y && m === ref.m && d >= ref.d)
return y > ref.y || (y === ref.y && (!m || m > ref.m)) || (y === ref.y && m === ref.m && (!d || d >= ref.d))
}
const today = () => {
const d = new Date()
return {
y: d.getFullYear(),
y: ''+d.getFullYear(),
m: pad0(d.getMonth() + 1),
d: pad0(d.getDate())
}
Expand Down

0 comments on commit c02a729

Please sign in to comment.