Skip to content

Commit 0ea3128

Browse files
committed
change app:firstday to mean that the activity occured on the same *calendar* day, not within 24 hours
1 parent 5f05213 commit 0ea3128

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

pkg/telemetry/telemetry.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,16 @@ func RecordTEvent(ctx context.Context, tevent *telemetrydata.TEvent) error {
241241
}
242242
tevent.EnsureTimestamps()
243243

244-
// Set AppFirstDay if within first day of TOS agreement
244+
// Set AppFirstDay if on same calendar day as TOS agreement
245245
tosAgreedTs := GetTosAgreedTs()
246-
if tosAgreedTs == 0 || (tosAgreedTs != 0 && time.Now().UnixMilli()-tosAgreedTs <= int64(24*60*60*1000)) {
246+
if tosAgreedTs == 0 {
247247
tevent.Props.AppFirstDay = true
248+
} else {
249+
tosYear, tosMonth, tosDay := time.UnixMilli(tosAgreedTs).Date()
250+
nowYear, nowMonth, nowDay := time.Now().Date()
251+
if tosYear == nowYear && tosMonth == nowMonth && tosDay == nowDay {
252+
tevent.Props.AppFirstDay = true
253+
}
248254
}
249255

250256
if tevent.Event == ActivityEventName {

0 commit comments

Comments
 (0)