(date, orig)
| 2894 | }; |
| 2895 | |
| 2896 | const formatDate = (date, orig) => { |
| 2897 | if (isTimestamp) { |
| 2898 | if (tsLength > 10) return date.getTime().toString(); |
| 2899 | return Math.floor(date.getTime() / 1000).toString(); |
| 2900 | } |
| 2901 | if (parser) { |
| 2902 | return myMoment(date).format(parser); |
| 2903 | } |
| 2904 | if (typeof orig === 'string') { |
| 2905 | const len = orig.length; |
| 2906 | if (len === 10) return myMoment(date).format('YYYY-MM-DD'); |
| 2907 | if (len === 16 && orig.includes('T')) return myMoment(date).format('YYYY-MM-DDTHH:mm'); |
| 2908 | if (len === 16) return myMoment(date).format('YYYY-MM-DD HH:mm'); |
| 2909 | if (len === 19 && orig.includes('T')) return myMoment(date).format('YYYY-MM-DDTHH:mm:ss'); |
| 2910 | if (len === 19) return myMoment(date).format('YYYY-MM-DD HH:mm:ss'); |
| 2911 | } |
| 2912 | return myMoment(date).format(); |
| 2913 | }; |
| 2914 | |
| 2915 | const sums = {}; |
| 2916 | const counts = {}; |
no test coverage detected