summaryrefslogtreecommitdiff
path: root/date-fns/src/_lib/isSameUTCWeek/index.js
blob: 699806fab0858387bca04d19c1faef4b2d509bec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import startOfUTCWeek from '../startOfUTCWeek/index'
import requiredArgs from '../requiredArgs/index'

// This function will be a part of public API when UTC function will be implemented.
// See issue: https://github.com/date-fns/date-fns/issues/376
export default function isSameUTCWeek(dirtyDateLeft, dirtyDateRight, options) {
  requiredArgs(2, arguments)

  var dateLeftStartOfWeek = startOfUTCWeek(dirtyDateLeft, options)
  var dateRightStartOfWeek = startOfUTCWeek(dirtyDateRight, options)

  return dateLeftStartOfWeek.getTime() === dateRightStartOfWeek.getTime()
}