Given:
Project time zone is “UTC+8”
Update a date-type user property “last_visit_date” to “2025-02-27” via JS SDK
When viewing user profile in Mixpanel:
The value of the “last_visit_date” property is displayed as “Thu, Feb 27, 2025 8:00AM”
When clicking the pencil/edit icon of the “last_visit_date” property, the editable value is “2025-02-27T08:00:00”
How do we make the “last_visit_date” property display “2025-02-27” in Mixpanel’s user profile view?
Hi Sharon L., Please stand by as I search the Mixpanel knowledge base for an AI-powered answer. I normally take about 15 seconds or so. In case AI cannot answer your question, feel free to reach out to Mixpanel support at mixpanel.com/get-support. If you have follow-up questions for this thread, please tag me again with your question: @kapa.ai <follow-up question> đź‘‹
Feel free to ask a follow-up question once I've answered by mentioning me with @kapa.ai
To address this question, we need to consider how Mixpanel handles date properties and timezones. Based on the information provided in the knowledge sources, here's the answer: To make the "last_visit_date" property display as "2025-02-27" in Mixpanel's user profile view, you should send the date in UTC format when updating the user property. The reason for the current behavior is that Mixpanel is interpreting the date based on the project's timezone setting (UTC+8).Here's how you can modify your JavaScript SDK code to achieve the desired result: LBKS// Create a Date object for 2025-02-27 in UTC const date = new Date(Date.UTC(2025, 1, 27)); // Note: Month is 0-indexed, so 1 represents FebruaryLBKS// Convert the date to ISO string format const isoDate = date.toISOString();LBKS// Update the user property mixpanel.people.set({ "last_visit_date": isoDate });LBKS
By using Date.UTC()
and toISOString()
, you ensure that the date is sent in the correct UTC format. This should result in the "last_visit_date" property being displayed as "2025-02-27" in the Mixpanel user profile view.It's important to note that, according to the Mixpanel documentation on Timezones, Mixpanel records all events in Coordinated Universal Time (UTC) at intake. The documentation states: "Mixpanel records all events in Coordinated Universal Time (UTC) at intake. Changing the timezone for any project under Project Settings only affects the timezone in which Mixpanel outputs results."By sending the date in UTC format, you ensure that Mixpanel interprets it correctly, regardless of the project's timezone setting.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.
Let me check the knowledge base for you again. One moment! đź“š
Yes, that's correct. Even if you only want to record the date in "yyyy-MM-dd" format for a user property, it's best practice to convert it to an ISO date format before sending it to Mixpanel. This approach ensures consistent handling of date properties across Mixpanel's systems.According to the Mixpanel documentation on Property Data Types, Mixpanel recommends using an ISO-formatted date string for date properties: "For this type of property, Mixpanel recommends an iso-formatted date string (YYYY-MM-DDTHH:mm:ss) to use in your Mixpanel reports."The reason for this recommendation is that Mixpanel treats date properties in a specific way. By sending the date in ISO format, you ensure that: 1. The date is interpreted correctly by Mixpanel's systems. 2. You avoid any potential issues with timezone conversions. 3. You maintain consistency across your data, which is crucial for accurate reporting and analysis.When you send a date in ISO format (e.g., "2025-02-27T00:00:00Z"), Mixpanel will still understand that you're referring to the date "2025-02-27". The time component (T00:00:00Z) simply specifies that it's the start of the day in UTC.If you want to ensure that only the date part is displayed in the user profile view, you might need to adjust how Mixpanel displays the date in its UI. However, for data integrity and consistency, it's recommended to send the full ISO-formatted date to Mixpanel.
kapa.ai is still learning and improving, please let me know how I did by reacting below.
ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.