diff --git a/CHANGELOG.md b/CHANGELOG.md index 2615c899d..7d930ec4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/ui/spec/shared/parsing/resultsToCSVSpec.js b/ui/spec/shared/parsing/resultsToCSVSpec.js index 6945e713d..aa8199566 100644 --- a/ui/spec/shared/parsing/resultsToCSVSpec.js +++ b/ui/spec/shared/parsing/resultsToCSVSpec.js @@ -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 + ) }) }) diff --git a/ui/src/shared/parsing/resultsToCSV.js b/ui/src/shared/parsing/resultsToCSV.js index 8ba25b2d5..c3d3fdd02 100644 --- a/ui/src/shared/parsing/resultsToCSV.js +++ b/ui/src/shared/parsing/resultsToCSV.js @@ -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'])) {