(
date,
options: { needSub?: boolean; withTime?: boolean; isUnix?: boolean } = {},
)
| 99 | }; |
| 100 | |
| 101 | export const formatDate = ( |
| 102 | date, |
| 103 | options: { needSub?: boolean; withTime?: boolean; isUnix?: boolean } = {}, |
| 104 | ) => { |
| 105 | const { needSub, withTime, isUnix } = options; |
| 106 | let finalDate = dayjs.isDayjs(date) |
| 107 | ? date |
| 108 | : isUnix |
| 109 | ? dayjs.unix(date) |
| 110 | : dayjs(date); |
| 111 | if (needSub) { |
| 112 | finalDate = date.subtract(1, "ms"); |
| 113 | } |
| 114 | if (withTime) { |
| 115 | return finalDate.format("MMM D, YYYY h:mmA"); |
| 116 | } |
| 117 | return finalDate.format("MMM D, YYYY"); |
| 118 | }; |
| 119 | |
| 120 | export const trimErrorMessage = (message) => { |
| 121 | return message.split("(")[0].trim(); |
nothing calls this directly
no outgoing calls
no test coverage detected