(currentDate: Date)
| 186 | }; |
| 187 | |
| 188 | export const getReadHistoryDateFormat = (currentDate: Date): string => { |
| 189 | const today = new Date(); |
| 190 | |
| 191 | if (isDateOnlyEqual(today, currentDate)) { |
| 192 | return 'Today'; |
| 193 | } |
| 194 | |
| 195 | if (isDateOnlyEqual(today, addDays(currentDate, 1))) { |
| 196 | return 'Yesterday'; |
| 197 | } |
| 198 | |
| 199 | const dayOfTheWeek = format(currentDate, 'EEE'); |
| 200 | const dayOfTheMonth = currentDate.getDate(); |
| 201 | const month = format(currentDate, 'MMM'); |
| 202 | const currentYear = currentDate.getFullYear(); |
| 203 | const year = currentYear === today.getFullYear() ? '' : ` ${currentYear}`; |
| 204 | |
| 205 | return `${dayOfTheWeek}, ${dayOfTheMonth} ${month}${year}`; |
| 206 | }; |
| 207 | |
| 208 | export const getTopReaderBadgeDateFormat = (date: string | Date): string => { |
| 209 | return new Date(date).toLocaleString('en-US', { |
no test coverage detected