Skip to content

Commit b38ef99

Browse files
author
Robert-Jan Huijsman
authored
Analytics: rename 'event.data.date' to 'event.data.reportingDate' (#122)
1 parent 4dd5a62 commit b38ef99

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

spec/providers/analytics.spec.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const fullPayload = JSON.parse(`{
125125

126126
// The event data that we expect would be constructed if the payload above were to arrive.
127127
export const fullEventData: AnalyticsEvent = {
128-
date: '20170202',
128+
reportingDate: '20170202',
129129
name: 'Loaded_In_Background',
130130
params: {
131131
build: '1350',

spec/providers/analytics.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('AnalyticsEventBuilder', () => {
116116
};
117117

118118
return expect(cloudFunction(event)).to.eventually.deep.equal({
119-
date: '20170202',
119+
reportingDate: '20170202',
120120
name: 'Loaded_In_Background',
121121
params: {
122122
build: '1350',
@@ -163,7 +163,7 @@ describe('AnalyticsEventBuilder', () => {
163163
};
164164

165165
return expect(cloudFunction(event)).to.eventually.deep.equal({
166-
date: '20170202',
166+
reportingDate: '20170202',
167167
name: 'Loaded_In_Background',
168168
params: {},
169169
logTime: '2017-03-09T17:30:00.000Z',
@@ -214,7 +214,7 @@ describe('AnalyticsEventBuilder', () => {
214214
};
215215

216216
return expect(cloudFunction(event)).to.eventually.deep.equal({
217-
date: '20170202',
217+
reportingDate: '20170202',
218218
name: 'Loaded_In_Background',
219219
params: {},
220220
valueInUSD: 123.4, // Field renamed Usd -> USD.

src/providers/analytics.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ export class AnalyticsEvent {
240240
/** The date on which the event.was logged.
241241
* (YYYYMMDD format in the registered timezone of your app.)
242242
*/
243-
date: string;
243+
reportingDate: string;
244244

245245
/** The name of the event. */
246246
name: string;
@@ -269,9 +269,10 @@ export class AnalyticsEvent {
269269
if (wireFormat.eventDim && wireFormat.eventDim.length > 0) {
270270
// If there's an eventDim, there'll always be exactly one.
271271
let eventDim = wireFormat.eventDim[0];
272-
copyFields(eventDim, this, ['date', 'name']);
272+
copyField(eventDim, this, 'name');
273273
copyField(eventDim, this, 'params', p => _.mapValues(p, unwrapValue));
274274
copyFieldTo(eventDim, this, 'valueInUsd', 'valueInUSD');
275+
copyFieldTo(eventDim, this, 'date', 'reportingDate');
275276
copyTimestampToString(eventDim, this, 'timestampMicros', 'logTime');
276277
copyTimestampToString(eventDim, this, 'previousTimestampMicros', 'previousLogTime');
277278
}

0 commit comments

Comments
 (0)