Merge pull request #2167 from influxdata/fractional_seconds_in_csv
Adds fractions of seconds to time field in csv exportpull/2158/head^2
commit
20e4037eda
|
@ -1,5 +1,6 @@
|
|||
## v1.3.11.0 [unreleased]
|
||||
### Bug Fixes
|
||||
1. [#2167](https://github.com/influxdata/chronograf/pull/2167): Add fractions of seconds to time field in csv export
|
||||
### Features
|
||||
### UI Improvements
|
||||
|
||||
|
|
|
@ -3,13 +3,16 @@ import {
|
|||
formatDate,
|
||||
dashboardtoCSV,
|
||||
} from 'shared/parsing/resultsToCSV'
|
||||
import moment from 'moment'
|
||||
|
||||
describe('formatDate', () => {
|
||||
it('converts timestamp to an excel compatible date string', () => {
|
||||
const timestamp = 1000000000000
|
||||
const result = formatDate(timestamp)
|
||||
expect(result).to.be.a('string')
|
||||
expect(+new Date(result)).to.equal(timestamp)
|
||||
expect(moment(result, 'M/D/YYYY h:mm:ss.SSSSSSSSS A').valueOf()).to.equal(
|
||||
timestamp
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import _ from 'lodash'
|
|||
import moment from 'moment'
|
||||
|
||||
export const formatDate = timestamp =>
|
||||
moment(timestamp).format('M/D/YYYY h:mm:ss A')
|
||||
moment(timestamp).format('M/D/YYYY h:mm:ss.SSSSSSSSS A')
|
||||
|
||||
export const resultsToCSV = results => {
|
||||
if (!_.get(results, ['0', 'series', '0'])) {
|
||||
|
|
Loading…
Reference in New Issue