diff --git a/frontend/__snapshots__/scenes-other-settings--settings-project--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-project--dark.png index e11ac5731e92d..6fd94d7339d5d 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-project--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-project--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-project--light.png b/frontend/__snapshots__/scenes-other-settings--settings-project--light.png index d6d3e0c1b0320..a2f72322ef477 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-project--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-project--light.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--dark.png index 05e473e182395..b298a92bbf7a1 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--light.png b/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--light.png index 735c420a3f20a..51db6867464c5 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-project-with-replay-features--light.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--dark.png index e11ac5731e92d..6fd94d7339d5d 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--light.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--light.png index d6d3e0c1b0320..a2f72322ef477 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-all-options--light.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--dark.png index e11ac5731e92d..6fd94d7339d5d 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--light.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--light.png index d6d3e0c1b0320..a2f72322ef477 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-password-only--light.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--dark.png index e11ac5731e92d..6fd94d7339d5d 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--light.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--light.png index d6d3e0c1b0320..a2f72322ef477 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-github--light.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--dark.png index e11ac5731e92d..6fd94d7339d5d 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--light.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--light.png index d6d3e0c1b0320..a2f72322ef477 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-google--light.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--dark.png index e11ac5731e92d..6fd94d7339d5d 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--light.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--light.png index d6d3e0c1b0320..a2f72322ef477 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-enforced-saml--light.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--dark.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--dark.png index e11ac5731e92d..6fd94d7339d5d 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--dark.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--dark.png differ diff --git a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--light.png b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--light.png index d6d3e0c1b0320..a2f72322ef477 100644 Binary files a/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--light.png and b/frontend/__snapshots__/scenes-other-settings--settings-session-timeout-sso-only--light.png differ diff --git a/frontend/src/lib/api.mock.ts b/frontend/src/lib/api.mock.ts index 75ee08ffba75c..a480f26b42b97 100644 --- a/frontend/src/lib/api.mock.ts +++ b/frontend/src/lib/api.mock.ts @@ -93,6 +93,7 @@ export const MOCK_DEFAULT_TEAM: TeamType = { person_on_events_querying_enabled: true, live_events_token: '123', capture_dead_clicks: false, + human_friendly_comparison_periods: false, } export const MOCK_DEFAULT_PROJECT: ProjectType = { diff --git a/frontend/src/scenes/settings/SettingsMap.tsx b/frontend/src/scenes/settings/SettingsMap.tsx index d2e46cb6e6636..9b81edb21de22 100644 --- a/frontend/src/scenes/settings/SettingsMap.tsx +++ b/frontend/src/scenes/settings/SettingsMap.tsx @@ -20,6 +20,7 @@ import { DataAttributes } from './environment/DataAttributes' import { DataColorThemes } from './environment/DataColorThemes' import { GroupAnalyticsConfig } from './environment/GroupAnalyticsConfig' import { HeatmapsSettings } from './environment/HeatmapsSettings' +import { HumanFriendlyComparisonPeriodsSetting } from './environment/HumanFriendlyComparisonPeriodsSetting' import { IPAllowListInfo } from './environment/IPAllowListInfo' import { IPCapture } from './environment/IPCapture' import { ManagedReverseProxy } from './environment/ManagedReverseProxy' @@ -191,6 +192,11 @@ export const SETTINGS_MAP: SettingSection[] = [ title: 'IP data capture configuration', component: , }, + { + id: 'human-friendly-comparison-periods', + title: 'Human friendly comparison periods', + component: , + }, { id: 'group-analytics', title: 'Group analytics', diff --git a/frontend/src/scenes/settings/environment/HumanFriendlyComparisonPeriodsSetting.tsx b/frontend/src/scenes/settings/environment/HumanFriendlyComparisonPeriodsSetting.tsx new file mode 100644 index 0000000000000..8aad3ddb90d98 --- /dev/null +++ b/frontend/src/scenes/settings/environment/HumanFriendlyComparisonPeriodsSetting.tsx @@ -0,0 +1,32 @@ +import { LemonSwitch } from '@posthog/lemon-ui' +import { useActions, useValues } from 'kea' +import { teamLogic } from 'scenes/teamLogic' + +export function HumanFriendlyComparisonPeriodsSetting(): JSX.Element { + const { updateCurrentTeam } = useActions(teamLogic) + const { currentTeam, currentTeamLoading } = useValues(teamLogic) + + return ( + <> +

+ When comparing against a previous month or year, PostHog will use the same start and end dates as the + current period by default. It might be desirable, however, to compare against the same day of the week + instead of the same day to account for weekend seasonality. If that's the case for your analysis, you + can enable this setting. +

+

+ In practice, this means that an year comparison becomes a 52 week comparison, and a month comparison + becomes a 4 week comparison. +

+ { + updateCurrentTeam({ human_friendly_comparison_periods: checked }) + }} + checked={!!currentTeam?.human_friendly_comparison_periods} + disabled={currentTeamLoading} + label="Use human friendly comparison periods" + bordered + /> + + ) +} diff --git a/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snap b/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snap index 47c205486a7e8..697dc2f7f1fc0 100644 --- a/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snap +++ b/frontend/src/scenes/settings/organization/VerifiedDomains/__snapshots__/verifiedDomainsLogic.test.ts.snap @@ -75,6 +75,7 @@ exports[`verifiedDomainsLogic values has proper defaults 1`] = ` "effective_membership_level": 8, "has_group_types": true, "heatmaps_opt_in": true, + "human_friendly_comparison_periods": false, "id": 997, "ingested_event": true, "is_demo": false, diff --git a/frontend/src/scenes/settings/types.ts b/frontend/src/scenes/settings/types.ts index fc20388e67c40..4b7244ed4bff2 100644 --- a/frontend/src/scenes/settings/types.ts +++ b/frontend/src/scenes/settings/types.ts @@ -63,6 +63,7 @@ export type SettingId = | 'person-display-name' | 'path-cleaning' | 'datacapture' + | 'human-friendly-comparison-periods' | 'group-analytics' | 'persons-on-events' | 'replay' diff --git a/frontend/src/scenes/teamActivityDescriber.tsx b/frontend/src/scenes/teamActivityDescriber.tsx index a85dd03ac3f04..b79cd975af9d4 100644 --- a/frontend/src/scenes/teamActivityDescriber.tsx +++ b/frontend/src/scenes/teamActivityDescriber.tsx @@ -305,29 +305,6 @@ const teamActionsMapping: Record< ], } }, - // TODO if I had to test and describe every single one of this I'd never release this - // we can add descriptions here as the need arises - access_control: () => null, - anonymize_ips: () => null, - app_urls: () => null, - completed_snippet_onboarding: () => null, - correlation_config: () => null, - data_attributes: () => null, - effective_membership_level: () => null, - has_group_types: () => null, - ingested_event: () => null, - is_demo: () => null, - live_events_columns: () => null, - organization: () => null, - project_id: () => null, - path_cleaning_filters: () => null, - person_display_name_properties: () => null, - person_on_events_querying_enabled: () => null, - primary_dashboard: () => null, - slack_incoming_webhook: () => null, - timezone: () => null, - surveys_opt_in: () => null, - week_start_day: () => null, extra_settings: (change: ActivityChange | undefined): ChangeMapping | null => { const after = change?.after if (typeof after !== 'object') { @@ -336,7 +313,9 @@ const teamActionsMapping: Record< const descriptions = [] for (const key in after) { if (key === 'poe_v2_enabled') { - descriptions.push(<>{after[key] ? 'enabled' : 'disabled'} Person on Events (v2)) + descriptions.push( + <>{after[key as keyof typeof after] ? 'enabled' : 'disabled'} Person on Events (v2) + ) } } return { description: descriptions } @@ -350,24 +329,13 @@ const teamActionsMapping: Record< for (const key in after) { descriptions.push( <> - set {key} to "{String(after[key])}" + set {key} to "{String(after[key as keyof typeof after])}" ) } return { description: descriptions } }, - default_modifiers: () => null, - has_completed_onboarding_for: () => null, - // should never come from the backend - created_at: () => null, - api_token: () => null, - id: () => null, - updated_at: () => null, - uuid: () => null, - user_access_level: () => null, - live_events_token: () => null, - product_intents: () => null, - default_data_theme: (change) => { + default_data_theme: (change): ChangeMapping | null => { return { description: [ <> @@ -385,6 +353,55 @@ const teamActionsMapping: Record< ], } }, + human_friendly_comparison_periods: (change): ChangeMapping | null => { + if (!change) { + return null + } + + return { + description: [ + <> + {change?.after ? 'enabled' : 'disabled'} human friendly comparison periods + , + ], + } + }, + + // TODO if I had to test and describe every single one of this I'd never release this + // we can add descriptions here as the need arises + access_control: () => null, + anonymize_ips: () => null, + app_urls: () => null, + completed_snippet_onboarding: () => null, + correlation_config: () => null, + data_attributes: () => null, + effective_membership_level: () => null, + has_group_types: () => null, + ingested_event: () => null, + is_demo: () => null, + live_events_columns: () => null, + organization: () => null, + project_id: () => null, + path_cleaning_filters: () => null, + person_display_name_properties: () => null, + person_on_events_querying_enabled: () => null, + primary_dashboard: () => null, + slack_incoming_webhook: () => null, + timezone: () => null, + surveys_opt_in: () => null, + week_start_day: () => null, + default_modifiers: () => null, + has_completed_onboarding_for: () => null, + + // should never come from the backend + created_at: () => null, + api_token: () => null, + id: () => null, + updated_at: () => null, + uuid: () => null, + user_access_level: () => null, + live_events_token: () => null, + product_intents: () => null, cookieless_server_hash_mode: () => null, } @@ -409,11 +426,11 @@ export function teamActivityDescriber(logItem: ActivityLogItem, asNotification?: let changeSuffix: Description = <>on {nameAndLink(logItem)} for (const change of logItem.detail.changes || []) { - if (!change?.field || !teamActionsMapping[change.field]) { + if (!change?.field || !(change.field in teamActionsMapping)) { continue // not all notebook fields are describable } - const actionHandler = teamActionsMapping[change.field] + const actionHandler = teamActionsMapping[change.field as keyof TeamType] const processedChange = actionHandler(change, logItem) if (processedChange === null) { continue // // unexpected log from backend is indescribable diff --git a/frontend/src/types.ts b/frontend/src/types.ts index e638db249c396..09fcd30349b0f 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -550,6 +550,7 @@ export interface TeamType extends TeamBasicType { live_events_columns: string[] | null // Custom columns shown on the Live Events page live_events_token: string cookieless_server_hash_mode?: CookielessServerHashMode + human_friendly_comparison_periods: boolean /** Effective access level of the user in this specific team. Null if user has no access. */ effective_membership_level: OrganizationMembershipLevel | null diff --git a/posthog/api/team.py b/posthog/api/team.py index 3aa1338ce46a6..7186e84aa2436 100644 --- a/posthog/api/team.py +++ b/posthog/api/team.py @@ -202,6 +202,7 @@ class Meta: "live_events_columns", "recording_domains", "cookieless_server_hash_mode", + "human_friendly_comparison_periods", "person_on_events_querying_enabled", "inject_web_apps", "extra_settings", diff --git a/posthog/api/test/__snapshots__/test_action.ambr b/posthog/api/test/__snapshots__/test_action.ambr index be7461a298a6c..f4de6699d716b 100644 --- a/posthog/api/test/__snapshots__/test_action.ambr +++ b/posthog/api/test/__snapshots__/test_action.ambr @@ -83,6 +83,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -390,6 +391,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -906,6 +908,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_annotation.ambr b/posthog/api/test/__snapshots__/test_annotation.ambr index e12cd7a78b6ca..6b84f6718dcb4 100644 --- a/posthog/api/test/__snapshots__/test_annotation.ambr +++ b/posthog/api/test/__snapshots__/test_annotation.ambr @@ -83,6 +83,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -385,6 +386,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -833,6 +835,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index f6affd2437a9c..bf19b1219b282 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -318,6 +318,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -391,6 +392,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -477,6 +479,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -695,6 +698,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -779,6 +783,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -868,6 +873,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1239,6 +1245,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1312,6 +1319,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1400,6 +1408,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1477,6 +1486,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1679,6 +1689,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1890,6 +1901,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2092,6 +2104,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2201,6 +2214,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2294,6 +2308,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2367,6 +2382,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2455,6 +2471,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2532,6 +2549,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2734,6 +2752,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2933,6 +2952,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3135,6 +3155,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3244,6 +3265,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3316,6 +3338,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3441,6 +3464,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3517,6 +3541,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3594,6 +3619,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3812,6 +3838,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3989,6 +4016,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4062,6 +4090,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4139,6 +4168,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4588,6 +4618,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4661,6 +4692,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4747,6 +4779,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4965,6 +4998,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5049,6 +5083,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5138,6 +5173,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5255,6 +5291,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5473,6 +5510,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5618,6 +5656,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5836,6 +5875,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6166,6 +6206,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6239,6 +6280,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6327,6 +6369,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6404,6 +6447,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6606,6 +6650,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6694,6 +6739,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6908,6 +6954,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7037,6 +7084,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7202,6 +7250,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7311,6 +7360,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7660,6 +7710,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7769,6 +7820,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7862,6 +7914,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7935,6 +7988,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8023,6 +8077,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8100,6 +8155,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8302,6 +8358,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8390,6 +8447,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8604,6 +8662,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8729,6 +8788,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8894,6 +8954,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9003,6 +9064,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9344,6 +9406,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9453,6 +9516,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index 5b1dcc653d1d8..e9fa372dbfe4d 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -50,6 +50,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -145,6 +146,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -222,6 +224,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -424,6 +427,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -533,6 +537,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -630,6 +635,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -802,6 +808,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1004,6 +1011,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1103,6 +1111,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1175,6 +1184,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1360,6 +1370,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1437,6 +1448,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1639,6 +1651,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1715,6 +1728,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1874,6 +1888,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1951,6 +1966,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2153,6 +2169,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_element.ambr b/posthog/api/test/__snapshots__/test_element.ambr index 903b9ab705a8e..1a6a987ba4ac8 100644 --- a/posthog/api/test/__snapshots__/test_element.ambr +++ b/posthog/api/test/__snapshots__/test_element.ambr @@ -83,6 +83,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_feature_flag.ambr b/posthog/api/test/__snapshots__/test_feature_flag.ambr index 07eb0a9ef7ed1..bc2418527e9e7 100644 --- a/posthog/api/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_feature_flag.ambr @@ -1362,6 +1362,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1531,6 +1532,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_insight.ambr b/posthog/api/test/__snapshots__/test_insight.ambr index 82d0c4fc65096..9a9d2db26f329 100644 --- a/posthog/api/test/__snapshots__/test_insight.ambr +++ b/posthog/api/test/__snapshots__/test_insight.ambr @@ -722,6 +722,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -787,6 +788,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -859,6 +861,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -931,6 +934,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1073,6 +1077,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1330,6 +1335,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1616,6 +1622,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1765,6 +1772,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1891,6 +1899,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2066,6 +2075,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2166,6 +2176,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr index 1ac0107628d8a..ac5057c62bf77 100644 --- a/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr +++ b/posthog/api/test/__snapshots__/test_organization_feature_flag.ambr @@ -132,6 +132,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -209,6 +210,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -411,6 +413,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -487,6 +490,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -616,6 +620,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -716,6 +721,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -788,6 +794,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -930,6 +937,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1026,6 +1034,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1126,6 +1135,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1198,6 +1208,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1340,6 +1351,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1435,6 +1447,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1538,6 +1551,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1740,6 +1754,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1816,6 +1831,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1964,6 +1980,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2767,6 +2784,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_preflight.ambr b/posthog/api/test/__snapshots__/test_preflight.ambr index 2077015ad7de9..ef69f7efc7040 100644 --- a/posthog/api/test/__snapshots__/test_preflight.ambr +++ b/posthog/api/test/__snapshots__/test_preflight.ambr @@ -83,6 +83,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index af29d9df060c0..d1db7ad90bee3 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -86,6 +86,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -151,6 +152,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -228,6 +230,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -455,6 +458,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -554,6 +558,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -643,6 +648,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -870,6 +876,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -969,6 +976,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1046,6 +1054,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1118,6 +1127,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1345,6 +1355,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1433,6 +1444,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1510,6 +1522,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1746,6 +1759,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1855,6 +1869,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2175,6 +2190,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr index 7da87ca1ef1ed..31f26f695f73a 100644 --- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr +++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr @@ -83,6 +83,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -274,6 +275,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -597,6 +599,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -897,6 +900,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1374,6 +1378,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1446,6 +1451,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1577,6 +1583,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1642,6 +1649,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1714,6 +1722,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1786,6 +1795,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1928,6 +1938,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2052,6 +2063,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2269,6 +2281,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2724,6 +2737,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2824,6 +2838,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2957,6 +2972,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3022,6 +3038,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3118,6 +3135,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3242,6 +3260,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3447,6 +3466,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3649,6 +3669,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3749,6 +3770,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3888,6 +3910,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4034,6 +4057,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4106,6 +4130,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4178,6 +4203,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4320,6 +4346,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4444,6 +4471,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4643,6 +4671,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4965,6 +4994,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5265,6 +5295,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5475,6 +5506,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5892,6 +5924,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6017,6 +6050,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6204,6 +6238,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6477,6 +6512,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6577,6 +6613,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6677,6 +6714,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6781,6 +6819,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6853,6 +6892,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6995,6 +7035,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7067,6 +7108,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7139,6 +7181,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7292,6 +7335,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7416,6 +7460,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7633,6 +7678,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7835,6 +7881,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7935,6 +7982,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8047,6 +8095,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8119,6 +8168,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8191,6 +8241,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8333,6 +8384,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8457,6 +8509,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8662,6 +8715,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8871,6 +8925,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8971,6 +9026,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9071,6 +9127,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9143,6 +9200,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9215,6 +9273,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9411,6 +9470,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9700,6 +9760,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -9890,6 +9951,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -10075,6 +10137,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -10140,6 +10203,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -10265,6 +10329,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -10452,6 +10517,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -10733,6 +10799,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -10858,6 +10925,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -11045,6 +11113,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr index c728a480610ed..de80d2ac69770 100644 --- a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr +++ b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr @@ -83,6 +83,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -238,6 +239,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -475,6 +477,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -877,6 +880,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/hogql_queries/utils/query_compare_to_date_range.py b/posthog/hogql_queries/utils/query_compare_to_date_range.py index b72503e39d03a..4cabf097b1894 100644 --- a/posthog/hogql_queries/utils/query_compare_to_date_range.py +++ b/posthog/hogql_queries/utils/query_compare_to_date_range.py @@ -33,7 +33,12 @@ def dates(self) -> tuple[datetime, datetime]: current_period_date_from = super().date_from() current_period_date_to = super().date_to() - start_date = relative_date_parse(self.compare_to, self._team.timezone_info, now=current_period_date_from) + start_date = relative_date_parse( + self.compare_to, + self._team.timezone_info, + now=current_period_date_from, + human_friendly_comparison_periods=bool(self._team.human_friendly_comparison_periods), + ) return ( start_date, diff --git a/posthog/hogql_queries/utils/test/test_query_compare_to_date_range.py b/posthog/hogql_queries/utils/test/test_query_compare_to_date_range.py index 30181887fde8c..2e0c901bbdc0c 100644 --- a/posthog/hogql_queries/utils/test/test_query_compare_to_date_range.py +++ b/posthog/hogql_queries/utils/test/test_query_compare_to_date_range.py @@ -41,3 +41,40 @@ def test_feb(self): ) self.assertEqual(query_date_range.date_from(), parser.isoparse("2021-02-28T00:00:00Z")) self.assertEqual(query_date_range.date_to(), parser.isoparse("2021-03-02T23:59:59.999999Z")) + + # Same as above but with human friendly comparison periods, should use week instead of month/year + def test_minus_one_month_human_friendly(self): + self.team.human_friendly_comparison_periods = True + + now = parser.isoparse("2021-08-25T00:00:00.000Z") + date_range = DateRange(date_from="-48h") + query_date_range = QueryCompareToDateRange( + team=self.team, + date_range=date_range, + interval=IntervalType.DAY, + now=now, + compare_to="-1m", + ) + self.assertEqual(query_date_range.date_from(), parser.isoparse("2021-07-26T00:00:00Z")) + self.assertEqual(query_date_range.date_to(), parser.isoparse("2021-07-28T23:59:59.999999Z")) + + # Human friendly comparison periods guarantee that the end of the week is same day + self.assertEqual(query_date_range.date_to().isoweekday(), now.isoweekday()) + + def test_minus_one_year_human_friendly(self): + self.team.human_friendly_comparison_periods = True + + now = parser.isoparse("2021-08-25T00:00:00.000Z") + date_range = DateRange(date_from="-48h") + query_date_range = QueryCompareToDateRange( + team=self.team, + date_range=date_range, + interval=IntervalType.DAY, + now=now, + compare_to="-1y", + ) + self.assertEqual(query_date_range.date_from(), parser.isoparse("2020-08-24T00:00:00Z")) + self.assertEqual(query_date_range.date_to(), parser.isoparse("2020-08-26T23:59:59.999999Z")) + + # Human friendly comparison periods guarantee that the end of the week is same day + self.assertEqual(query_date_range.date_to().isoweekday(), now.isoweekday()) diff --git a/posthog/migrations/0540_team_human_friendly_comparison_periods.py b/posthog/migrations/0540_team_human_friendly_comparison_periods.py new file mode 100644 index 0000000000000..f5cd9ded5632a --- /dev/null +++ b/posthog/migrations/0540_team_human_friendly_comparison_periods.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.15 on 2024-12-27 19:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("posthog", "0539_user_role_at_organization"), + ] + + operations = [ + migrations.AddField( + model_name="team", + name="human_friendly_comparison_periods", + field=models.BooleanField(default=False, null=True, blank=True), + ), + ] diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txt index b182af0cabf6e..602ce56966064 100644 --- a/posthog/migrations/max_migration.txt +++ b/posthog/migrations/max_migration.txt @@ -1 +1 @@ -0539_user_role_at_organization +0540_team_human_friendly_comparison_periods diff --git a/posthog/models/filters/test/__snapshots__/test_filter.ambr b/posthog/models/filters/test/__snapshots__/test_filter.ambr index e9601ed37a646..9d9ed00a04c0b 100644 --- a/posthog/models/filters/test/__snapshots__/test_filter.ambr +++ b/posthog/models/filters/test/__snapshots__/test_filter.ambr @@ -50,6 +50,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -122,6 +123,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -194,6 +196,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -266,6 +269,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -338,6 +342,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/models/team/team.py b/posthog/models/team/team.py index 5cf0bd55005d7..87a23c725cbbd 100644 --- a/posthog/models/team/team.py +++ b/posthog/models/team/team.py @@ -282,6 +282,7 @@ class Meta: person_display_name_properties: ArrayField = ArrayField(models.CharField(max_length=400), null=True, blank=True) live_events_columns: ArrayField = ArrayField(models.TextField(), null=True, blank=True) recording_domains: ArrayField = ArrayField(models.CharField(max_length=200, null=True), blank=True, null=True) + human_friendly_comparison_periods = models.BooleanField(default=False, null=True, blank=True) cookieless_server_hash_mode = models.SmallIntegerField( default=CookielessServerHashMode.DISABLED, choices=CookielessServerHashMode.choices, null=True ) diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr index 43351b8340128..e62c4b66a763c 100644 --- a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr +++ b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr @@ -50,6 +50,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -122,6 +123,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -194,6 +196,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -266,6 +269,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -338,6 +342,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -519,6 +524,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -618,6 +624,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1030,6 +1037,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1182,6 +1190,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1254,6 +1263,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1326,6 +1336,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1398,6 +1409,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1470,6 +1482,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1542,6 +1555,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1647,6 +1661,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2206,6 +2221,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2349,6 +2365,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2970,6 +2987,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3113,6 +3131,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3486,6 +3505,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3722,6 +3742,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -3865,6 +3886,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4434,6 +4456,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4577,6 +4600,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -4975,6 +4999,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5208,6 +5233,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -5351,6 +5377,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6418,6 +6445,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -6561,6 +6589,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7138,6 +7167,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7281,6 +7311,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7836,6 +7867,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -7979,6 +8011,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8596,6 +8629,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -8739,6 +8773,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr index 0a4f22903ccf0..747270b5478c2 100644 --- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr +++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr @@ -73,6 +73,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -195,6 +196,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -272,6 +274,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -474,6 +477,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -615,6 +619,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -766,6 +771,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -843,6 +849,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1008,6 +1015,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1117,6 +1125,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1246,6 +1255,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1600,6 +1610,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index 531b385935652..70c56f7e2a2f2 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -174,6 +174,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -269,6 +270,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -346,6 +348,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -548,6 +551,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -647,6 +651,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -724,6 +729,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -789,6 +795,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -991,6 +998,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1153,6 +1161,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1355,6 +1364,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1454,6 +1464,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1573,6 +1584,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1650,6 +1662,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -1852,6 +1865,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2167,6 +2181,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2336,6 +2351,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2413,6 +2429,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", @@ -2615,6 +2632,7 @@ "posthog_team"."person_display_name_properties", "posthog_team"."live_events_columns", "posthog_team"."recording_domains", + "posthog_team"."human_friendly_comparison_periods", "posthog_team"."cookieless_server_hash_mode", "posthog_team"."primary_dashboard_id", "posthog_team"."default_data_theme", diff --git a/posthog/utils.py b/posthog/utils.py index 5a22bfcdde9ff..1657dbcfa00e2 100644 --- a/posthog/utils.py +++ b/posthog/utils.py @@ -174,6 +174,7 @@ def relative_date_parse_with_delta_mapping( timezone_info: ZoneInfo, *, always_truncate: bool = False, + human_friendly_comparison_periods: bool = False, now: Optional[datetime.datetime] = None, increase: bool = False, ) -> tuple[datetime.datetime, Optional[dict[str, int]], str | None]: @@ -201,71 +202,95 @@ def relative_date_parse_with_delta_mapping( parsed_dt = parsed_dt.astimezone(timezone_info) return parsed_dt, None, None - regex = r"\-?(?P[0-9]+)?(?P[a-zA-Z])(?PStart|End)?" + regex = r"\-?(?P[0-9]+)?(?P[hdwmqyHDWMQY])(?PStart|End)?" match = re.search(regex, input) parsed_dt = (now or dt.datetime.now()).astimezone(timezone_info) delta_mapping: dict[str, int] = {} if not match: return parsed_dt, delta_mapping, None - elif match.group("type") == "h": - if match.group("number"): - delta_mapping["hours"] = int(match.group("number")) - if match.group("position") == "Start": + + delta_mapping = get_delta_mapping_for( + **match.groupdict(), + human_friendly_comparison_periods=human_friendly_comparison_periods, + ) + + if increase: + parsed_dt += relativedelta(**delta_mapping) # type: ignore + else: + parsed_dt -= relativedelta(**delta_mapping) # type: ignore + + if always_truncate: + # Truncate to the start of the hour for hour-precision datetimes, to the start of the day for larger intervals + # TODO: Remove this from this function, this should not be the responsibility of it + if "hours" in delta_mapping: + parsed_dt = parsed_dt.replace(minute=0, second=0, microsecond=0) + else: + parsed_dt = parsed_dt.replace(hour=0, minute=0, second=0, microsecond=0) + return parsed_dt, delta_mapping, match.group("position") or None + + +def get_delta_mapping_for( + *, + kind: str, + number: Optional[str] = None, + position: Optional[str] = None, + human_friendly_comparison_periods: bool = False, +) -> dict[str, int]: + delta_mapping: dict[str, int] = {} + + if kind == "h": + if number: + delta_mapping["hours"] = int(number) + if position == "Start": delta_mapping["minute"] = 0 delta_mapping["second"] = 0 delta_mapping["microsecond"] = 0 - elif match.group("position") == "End": + elif position == "End": delta_mapping["minute"] = 59 delta_mapping["second"] = 59 delta_mapping["microsecond"] = 999999 - elif match.group("type") == "d": - if match.group("number"): - delta_mapping["days"] = int(match.group("number")) - if match.group("position") == "Start": + elif kind == "d": + if number: + delta_mapping["days"] = int(number) + if position == "Start": delta_mapping["hour"] = 0 delta_mapping["minute"] = 0 delta_mapping["second"] = 0 delta_mapping["microsecond"] = 0 - elif match.group("position") == "End": + elif position == "End": delta_mapping["hour"] = 23 delta_mapping["minute"] = 59 delta_mapping["second"] = 59 delta_mapping["microsecond"] = 999999 - elif match.group("type") == "w": - if match.group("number"): - delta_mapping["weeks"] = int(match.group("number")) - elif match.group("type") == "m": - if match.group("number"): - delta_mapping["months"] = int(match.group("number")) - if match.group("position") == "Start": + elif kind == "w": + if number: + delta_mapping["weeks"] = int(number) + elif kind == "m": + if number: + if human_friendly_comparison_periods: + delta_mapping["weeks"] = 4 + else: + delta_mapping["months"] = int(number) + if position == "Start": delta_mapping["day"] = 1 - elif match.group("position") == "End": + elif position == "End": delta_mapping["day"] = 31 - elif match.group("type") == "q": - if match.group("number"): - delta_mapping["weeks"] = 13 * int(match.group("number")) - elif match.group("type") == "y": - if match.group("number"): - delta_mapping["years"] = int(match.group("number")) - if match.group("position") == "Start": + elif kind == "q": + if number: + delta_mapping["weeks"] = 13 * int(number) + elif kind == "y": + if number: + if human_friendly_comparison_periods: + delta_mapping["weeks"] = 52 + else: + delta_mapping["years"] = int(number) + if position == "Start": delta_mapping["month"] = 1 delta_mapping["day"] = 1 - elif match.group("position") == "End": + elif position == "End": delta_mapping["day"] = 31 - if increase: - parsed_dt += relativedelta(**delta_mapping) # type: ignore - else: - parsed_dt -= relativedelta(**delta_mapping) # type: ignore - - if always_truncate: - # Truncate to the start of the hour for hour-precision datetimes, to the start of the day for larger intervals - # TODO: Remove this from this function, this should not be the responsibility of it - if "hours" in delta_mapping: - parsed_dt = parsed_dt.replace(minute=0, second=0, microsecond=0) - else: - parsed_dt = parsed_dt.replace(hour=0, minute=0, second=0, microsecond=0) - return parsed_dt, delta_mapping, match.group("position") or None + return delta_mapping def relative_date_parse( @@ -273,11 +298,17 @@ def relative_date_parse( timezone_info: ZoneInfo, *, always_truncate: bool = False, + human_friendly_comparison_periods: bool = False, now: Optional[datetime.datetime] = None, increase: bool = False, ) -> datetime.datetime: return relative_date_parse_with_delta_mapping( - input, timezone_info, always_truncate=always_truncate, now=now, increase=increase + input, + timezone_info, + always_truncate=always_truncate, + human_friendly_comparison_periods=human_friendly_comparison_periods, + now=now, + increase=increase, )[0]