Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jendiamond committed Nov 23, 2024
1 parent 54a34a3 commit 3f52fd4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/utils/formatEventSeriesDates.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import format from 'date-fns/format'
*/

function formatDates(startDate = '', endDate = '', dateFormat = 'long') {
const formatDate = (date, formatType) => (date ? format(new Date(date), formatType) : '')
const formatDate = (date, formatType) => (date ? format(new Date(date), formatType) : '')

const longFormat = 'MMMM d, Y'
const shortFormat = 'MMM d'
Expand All @@ -22,18 +22,17 @@ const formatDate = (date, formatType) => (date ? format(new Date(date), formatTy
// Handle the various scenarios
if (!endDate || start === end) {
switch (dateFormat) {
case "long":
case 'long':
return formatDate(startDate, longFormat) // Single date or no end date

case "short":
case 'short':
return formatDate(startDate, shortFormat) // Single date or no end date

case "shortWithYear":
case 'shortWithYear':
return formatDate(startDate, shortWithYearFormat) // Single date or no end date
}
}


if (dateFormat === 'short') {
const shortStart = formatDate(startDate, shortFormat)
const shortEnd = formatDate(endDate, shortFormat)
Expand Down

0 comments on commit 3f52fd4

Please sign in to comment.