(date, orig)
| 2879 | }; |
| 2880 | |
| 2881 | const formatDate = (date, orig) => { |
| 2882 | if (isTimestamp) { |
| 2883 | if (tsLength > 10) return date.getTime().toString(); |
| 2884 | return Math.floor(date.getTime() / 1000).toString(); |
| 2885 | } |
| 2886 | if (parser) { |
| 2887 | return myMoment(date).format(parser); |
| 2888 | } |
| 2889 | if (typeof orig === 'string') { |
| 2890 | const len = orig.length; |
| 2891 | if (len === 10) return myMoment(date).format('YYYY-MM-DD'); |
| 2892 | if (len === 16 && orig.includes('T')) return myMoment(date).format('YYYY-MM-DDTHH:mm'); |
| 2893 | if (len === 16) return myMoment(date).format('YYYY-MM-DD HH:mm'); |
| 2894 | if (len === 19 && orig.includes('T')) return myMoment(date).format('YYYY-MM-DDTHH:mm:ss'); |
| 2895 | if (len === 19) return myMoment(date).format('YYYY-MM-DD HH:mm:ss'); |
| 2896 | } |
| 2897 | return myMoment(date).format(); |
| 2898 | }; |
| 2899 | |
| 2900 | const sums = {}; |
| 2901 | const counts = {}; |
no test coverage detected