{"version":3,"file":"index.cjs","sources":[""],"sourcesContent":["import { isValidDate } from \"../isValidDate/index.ts\";\r\n\r\nexport type TGetPureDateArgs = Parameters<typeof getPureDate>;\r\n\r\nexport type TGetPureDateReturn = ReturnType<typeof getPureDate>;\r\n\r\n/**\r\n * Gets a Date instance without time (hours, minutes, seconds, and milliseconds)\r\n * @param date{*=}\r\n * @returns {Date|null}\r\n * @example\r\n * // How to get a date without time e.g., hours, minutes, seconds, and milliseconds?\r\n * const dateWithTime = new Date();\r\n * console.log(dateWithTime.getMilliseconds()); // => {number}\r\n * const dateWithoutTime = getPureDate(dateWithTime);\r\n * console.log(dateWithoutTime.getMilliseconds()); // => 0\r\n */\r\nexport const getPureDate = (date: any | undefined = new Date()): Date | null => {\r\n  const getWithoutTime = (date: Date) => {\r\n    date.setHours(0, 0, 0, 0);\r\n    return date;\r\n  };\r\n  if (isValidDate(date)) {\r\n    return getWithoutTime(date);\r\n  } else {\r\n    const convertedDare = new Date(date);\r\n    if (isValidDate(convertedDare)) {\r\n      return getPureDate(convertedDare);\r\n    } else {\r\n      return null;\r\n    }\r\n  }\r\n};\r\n"],"names":["getPureDate","date","Date","getWithoutTime","setHours","isValidDate","convertedDare"],"mappings":";;;;;;;;;;;GAiBO,MAAMA,YAAcA,CAACC,KAAwB,IAAIC,QACtD,MAAMC,eAAkBF,OACtBA,KAAKG,SAAS,EAAG,EAAG,EAAG,GACvB,OAAOH,MAET,GAAII,MAAAA,YAAYJ,MACd,OAAOE,eAAeF,UACjB,CACL,MAAMK,cAAgB,IAAIJ,KAAKD,MAC/B,GAAII,MAAAA,YAAYC,eACd,OAAON,YAAYM,oBAEnB,OAAO,IAEX"}