(date, orig)
| 2223 | }; |
| 2224 | |
| 2225 | const formatDate = (date, orig) => { |
| 2226 | if (isTimestamp) { |
| 2227 | if (tsLength > 10) return date.getTime().toString(); |
| 2228 | return Math.floor(date.getTime() / 1000).toString(); |
| 2229 | } |
| 2230 | if (parser) { |
| 2231 | return myMoment(date).format(parser); |
| 2232 | } |
| 2233 | if (typeof orig === 'string') { |
| 2234 | const len = orig.length; |
| 2235 | if (len === 10) return myMoment(date).format('YYYY-MM-DD'); |
| 2236 | if (len === 16 && orig.includes('T')) return myMoment(date).format('YYYY-MM-DDTHH:mm'); |
| 2237 | if (len === 16) return myMoment(date).format('YYYY-MM-DD HH:mm'); |
| 2238 | if (len === 19 && orig.includes('T')) return myMoment(date).format('YYYY-MM-DDTHH:mm:ss'); |
| 2239 | if (len === 19) return myMoment(date).format('YYYY-MM-DD HH:mm:ss'); |
| 2240 | } |
| 2241 | return myMoment(date).format(); |
| 2242 | }; |
| 2243 | |
| 2244 | const sums = {}; |
| 2245 | const counts = {}; |
no test coverage detected