{"version":3,"sources":["../src/weekStart.ts"],"sourcesContent":["import { date } from \"./date\"\nimport type { MaybeDateInput } from \"./types\"\n\n/**\n * Returns a Date object for start of the given week. Defaults to Sunday as the\n * first day of the week:\n * 0 = Sunday ... 6 = Saturday\n * @param [inputDate] - A string, Date object or nothing for current week\n * @param [startOfWeekDay] - Determines which day of the week is the first\n */\nexport function weekStart(inputDate?: MaybeDateInput, startOfWeekDay = 0): Date {\n  const d = date(inputDate)\n  let diff = startOfWeekDay - d.getDay()\n  if (diff > 0) diff = diff - 7\n  d.setDate(d.getDate() + diff)\n  d.setHours(0, 0, 0, 0)\n  return d\n}\n"],"mappings":";AAAA,SAAS,YAAY;AAUd,SAAS,UAAU,WAA4B,iBAAiB,GAAS;AAC9E,QAAM,IAAI,KAAK,SAAS;AACxB,MAAI,OAAO,iBAAiB,EAAE,OAAO;AACrC,MAAI,OAAO,EAAG,QAAO,OAAO;AAC5B,IAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI;AAC5B,IAAE,SAAS,GAAG,GAAG,GAAG,CAAC;AACrB,SAAO;AACT;","names":[]}