{"version":3,"file":"selectPackage-jmusfDfI.js","sources":["../../../app/javascript/src/utils/selectPackage.js"],"sourcesContent":["import moment from 'moment-timezone';\n\nexport const calcDaysCount = event => {\n  const { startsAt, endsAt, timezone } = event;\n  return moment.tz(endsAt, timezone || 'Etc/UTC').startOf('day').diff(moment.tz(startsAt, timezone || 'Etc/UTC').startOf('day'), 'days') + 1;\n};\n\nexport const calcDateRange = event => {\n  const start = moment.tz(event.startsAt, event.timezone);\n  const end = moment.tz(event.endsAt, event.timezone);\n\n  const startMonth = start.format('MMM');\n  const startDay = start.format('D');\n  const startYear = start.format('YYYY');\n\n  const endMonth = end.format('MMM');\n  const endDay = end.format('D');\n  const endYear = end.format('YYYY');\n\n  // Same month, same year\n  if (startMonth === endMonth && startYear === endYear) {\n    return `${startMonth} ${startDay} – ${endDay}, ${startYear}`;\n  }\n  // Different month, same year\n  else if (startYear === endYear) {\n    return `${startMonth} ${startDay} – ${endMonth} ${endDay}, ${startYear}`;\n  }\n  // Different year\n  else {\n    return `${startMonth} ${startDay}, ${startYear} – ${endMonth} ${endDay}, ${endYear}`;\n  }\n};\n"],"names":["calcDaysCount","event","startsAt","endsAt","timezone","moment","calcDateRange","start","end","startMonth","startDay","startYear","endMonth","endDay","endYear"],"mappings":"wCAEY,MAACA,EAAgBC,GAAS,CACpC,KAAM,CAAE,SAAAC,EAAU,OAAAC,EAAQ,SAAAC,CAAU,EAAGH,EACvC,OAAOI,EAAO,GAAGF,EAAQC,GAAY,SAAS,EAAE,QAAQ,KAAK,EAAE,KAAKC,EAAO,GAAGH,EAAUE,GAAY,SAAS,EAAE,QAAQ,KAAK,EAAG,MAAM,EAAI,CAC3I,EAEaE,EAAgBL,GAAS,CACpC,MAAMM,EAAQF,EAAO,GAAGJ,EAAM,SAAUA,EAAM,QAAQ,EAChDO,EAAMH,EAAO,GAAGJ,EAAM,OAAQA,EAAM,QAAQ,EAE5CQ,EAAaF,EAAM,OAAO,KAAK,EAC/BG,EAAWH,EAAM,OAAO,GAAG,EAC3BI,EAAYJ,EAAM,OAAO,MAAM,EAE/BK,EAAWJ,EAAI,OAAO,KAAK,EAC3BK,EAASL,EAAI,OAAO,GAAG,EACvBM,EAAUN,EAAI,OAAO,MAAM,EAGjC,OAAIC,IAAeG,GAAYD,IAAcG,EACpC,GAAGL,CAAU,IAAIC,CAAQ,MAAMG,CAAM,KAAKF,CAAS,GAGnDA,IAAcG,EACd,GAAGL,CAAU,IAAIC,CAAQ,MAAME,CAAQ,IAAIC,CAAM,KAAKF,CAAS,GAI/D,GAAGF,CAAU,IAAIC,CAAQ,KAAKC,CAAS,MAAMC,CAAQ,IAAIC,CAAM,KAAKC,CAAO,EAEtF"}