(currentDate: Date)
| 201 | }; |
| 202 | |
| 203 | export const getReadHistoryDateFormat = (currentDate: Date): string => { |
| 204 | const today = new Date(); |
| 205 | |
| 206 | if (isDateOnlyEqual(today, currentDate)) { |
| 207 | return 'Today'; |
| 208 | } |
| 209 | |
| 210 | if (isDateOnlyEqual(today, addDays(currentDate, 1))) { |
| 211 | return 'Yesterday'; |
| 212 | } |
| 213 | |
| 214 | const dayOfTheWeek = format(currentDate, 'EEE'); |
| 215 | const dayOfTheMonth = currentDate.getDate(); |
| 216 | const month = format(currentDate, 'MMM'); |
| 217 | const currentYear = currentDate.getFullYear(); |
| 218 | const year = currentYear === today.getFullYear() ? '' : ` ${currentYear}`; |
| 219 | |
| 220 | return `${dayOfTheWeek}, ${dayOfTheMonth} ${month}${year}`; |
| 221 | }; |
| 222 | |
| 223 | export const getTopReaderBadgeDateFormat = (date: string | Date): string => { |
| 224 | return new Date(date).toLocaleString('en-US', { |
no test coverage detected