Skip to content

Commit

Permalink
fix: date utils: isSameDate() returns erroneous results in certain sc…
Browse files Browse the repository at this point in the history
…enarios #1804
  • Loading branch information
rstoenescu committed Mar 19, 2018
1 parent 1fae69e commit a491793
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,27 +271,27 @@ export function isSameDate (date, date2, unit) {

switch (unit) {
case 'second':
if (t.getUTCSeconds() !== d.getUTCSeconds()) {
if (t.getSeconds() !== d.getSeconds()) {
return false
}
case 'minute': // intentional fall-through
if (t.getUTCMinutes() !== d.getUTCMinutes()) {
if (t.getMinutes() !== d.getMinutes()) {
return false
}
case 'hour': // intentional fall-through
if (t.getUTCHours() !== d.getUTCHours()) {
if (t.getHours() !== d.getHours()) {
return false
}
case 'day': // intentional fall-through
if (t.getUTCDate() !== d.getUTCDate()) {
if (t.getDate() !== d.getDate()) {
return false
}
case 'month': // intentional fall-through
if (t.getUTCMonth() !== d.getUTCMonth()) {
if (t.getMonth() !== d.getMonth()) {
return false
}
case 'year': // intentional fall-through
if (t.getUTCFullYear() !== d.getUTCFullYear()) {
if (t.getFullYear() !== d.getFullYear()) {
return false
}
break
Expand Down

0 comments on commit a491793

Please sign in to comment.