Merge pull request #2167 from influxdata/fractional_seconds_in_csv

Adds fractions of seconds to time field in csv export
pull/2158/head^2
Deniz Kusefoglu 2017-10-27 10:27:20 -07:00 committed by GitHub
commit 20e4037eda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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
)
})
})

View File

@ -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'])) {