Skip to content

Comments

Traits.SetCreatedAt converts time.Time to Unix timestamp#4

Open
Noah-Codex wants to merge 1 commit intocustomerio:mainfrom
Noah-Codex:fix-setcreatedat-unix-timestamp
Open

Traits.SetCreatedAt converts time.Time to Unix timestamp#4
Noah-Codex wants to merge 1 commit intocustomerio:mainfrom
Noah-Codex:fix-setcreatedat-unix-timestamp

Conversation

@Noah-Codex
Copy link

@Noah-Codex Noah-Codex commented Dec 13, 2024

Before

When uploading a time.Time value to the reserved createdAt attribute, the API succeeds with status 200 OK, but displays an Invalid Date when viewing the People tab in Journeys.

In fact, attempting to Round or Truncate the time.Time in any fashion has the same results.

Screenshot 2024-12-13 at 8 50 13 AM
Screenshot 2024-12-13 at 8 49 46 AM

After

I then noticed that a default segment documents created_at to expect a UNIX timestamp.

Screenshot 2024-12-13 at 8 53 39 AM

When instead manually setting the createdAt as shown below, I instead got the desired result.

identify := analytics.Identify{
	Traits: analytics.NewTraits().
		Set("createdAt", time.Now().Unix()),
	UserId: userID,
}

Result

Screenshot 2024-12-13 at 8 55 03 AM

Screenshot 2024-12-13 at 8 55 23 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant