Skip to content

Commit

Permalink
Add seconds to telemetry (#100)
Browse files Browse the repository at this point in the history
* show local time with seconds for telemetry

* update version
  • Loading branch information
YingXue authored Aug 30, 2019
1 parent d5456a9 commit 6570492
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-iot-explorer",
"version": "0.10.1",
"version": "0.10.2",
"description": "This project welcomes contributions and suggestions. Most contributions require you to agree to a\r Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\r the rights to use your contribution. For details, visit https://cla.microsoft.com.",
"main": "public/electron.js",
"build": {
Expand Down
13 changes: 10 additions & 3 deletions src/app/api/dataTransforms/deviceSummaryTransform.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Device } from '../models/device';
import { DeviceSummary } from '../models/deviceSummary';

describe('utils', () => {

describe('transformDevice', () => {
it('transforms Device to DeviceSummary', () => {
const device: Device = {
Expand All @@ -25,11 +24,19 @@ describe('utils', () => {
authenticationType: 'Sas',
cloudToDeviceMessageCount: '0',
deviceId: 'test',
lastActivityTime: '10:01 AM, July 18, 2019',
lastActivityTime: '3:01:20 AM, July 18, 2019',
status: 'Enabled',
statusUpdatedTime: null,
};
expect(transformDevice(device)).toEqual(deviceSummary);

const transformedDevice = transformDevice(device);
expect(transformedDevice.authenticationType).toEqual(deviceSummary.authenticationType);
expect(transformedDevice.cloudToDeviceMessageCount).toEqual(deviceSummary.cloudToDeviceMessageCount);
expect(transformedDevice.deviceId).toEqual(deviceSummary.deviceId);
const isLocalTime = new RegExp(/\d+:\d+:\d+ [AP]M, July 18, 2019/);
expect(transformedDevice.lastActivityTime.match(isLocalTime)).toBeTruthy();
expect(transformedDevice.status).toEqual(deviceSummary.status);
expect(transformedDevice.statusUpdatedTime).toEqual(deviceSummary.statusUpdatedTime);
});
});
});
3 changes: 2 additions & 1 deletion src/app/api/dataTransforms/transformHelper.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ describe('transformHelper', () => {

describe('parseDateTimeString', () => {
it('parses date time string', () => {
expect(parseDateTimeString('2019-07-18T10:01:20.0568390Z')).toEqual('10:01 AM, July 18, 2019');
const isLocalTime = new RegExp(/\d+:\d+:\d+ [AP]M, July 18, 2019/);
expect(parseDateTimeString('2019-07-18T10:01:20.0568390Z').match(isLocalTime)).toBeTruthy();
expect(parseDateTimeString('0001-01-01T00:00:00')).toEqual(null);
expect(parseDateTimeString('')).toEqual(null);
expect(parseDateTimeString('someday')).toEqual(null);
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/dataTransforms/transformHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ export const parseDateTimeString = (dateTimeString: string): string => {
return null;
}

return moment.utc(dateTimeString).format('h:mm A, MMMM DD, YYYY');
return moment.utc(dateTimeString).local().format('h:mm:ss A, MMMM DD, YYYY');
};

0 comments on commit 6570492

Please sign in to comment.