Skip to content

Commit 478d2b6

Browse files
committed
fix iso format for segment date range operator
1 parent d6f74a5 commit 478d2b6

File tree

6 files changed

+54
-23
lines changed

6 files changed

+54
-23
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [22.5] - 2026-01-06
6+
7+
### Bug Fixes
8+
9+
- **Segment Date Filters**: Fixed date picker sending dates in wrong format (`YYYY-MM-DD HH:mm:ss` instead of ISO8601). Frontend now sends proper RFC3339 format for all segment date filters including contact fields, timeline timeframes, and custom events goal timeframes (fixes #182)
10+
511
## [22.4] - 2026-01-06
612

713
### Bug Fixes

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/spf13/viper"
1515
)
1616

17-
const VERSION = "22.4"
17+
const VERSION = "22.5"
1818

1919
type Config struct {
2020
Server ServerConfig

console/src/components/segment/form_leaf.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,9 @@ export const LeafActionForm = (props: LeafFormProps) => {
395395
})
396396
}
397397
}}
398-
getValueFromEvent={(_date: [Dayjs | null, Dayjs | null] | null, dateStrings: string[]) => dateStrings}
398+
getValueFromEvent={(dates: [Dayjs | null, Dayjs | null] | null) =>
399+
dates ? dates.map((date) => (date ? date.toISOString() : undefined)) : undefined
400+
}
399401
>
400402
<DatePicker.RangePicker
401403
style={{ width: 370 }}
@@ -420,7 +422,7 @@ export const LeafActionForm = (props: LeafFormProps) => {
420422
getValueProps={(value: string) => {
421423
return { value: value ? dayjs(value) : undefined }
422424
}}
423-
getValueFromEvent={(_date: Dayjs | null, dateString: string) => dateString}
425+
getValueFromEvent={(date: Dayjs | null) => (date ? date.toISOString() : undefined)}
424426
>
425427
<DatePicker
426428
style={{ width: 180 }}
@@ -699,7 +701,9 @@ export const LeafCustomEventsGoalForm = (props: LeafFormProps) => {
699701
})
700702
}
701703
}}
702-
getValueFromEvent={(_date: [Dayjs | null, Dayjs | null] | null, dateStrings: string[]) => dateStrings}
704+
getValueFromEvent={(dates: [Dayjs | null, Dayjs | null] | null) =>
705+
dates ? dates.map((date) => (date ? date.toISOString() : undefined)) : undefined
706+
}
703707
>
704708
<DatePicker.RangePicker
705709
style={{ width: 370 }}
@@ -724,7 +728,7 @@ export const LeafCustomEventsGoalForm = (props: LeafFormProps) => {
724728
getValueProps={(value: string) => {
725729
return { value: value ? dayjs(value) : undefined }
726730
}}
727-
getValueFromEvent={(_date: Dayjs | null, dateString: string) => dateString}
731+
getValueFromEvent={(date: Dayjs | null) => (date ? date.toISOString() : undefined)}
728732
>
729733
<DatePicker
730734
style={{ width: 180 }}

console/src/components/segment/input.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ import {
1818
BooleanOperator
1919
} from '../../services/api/segment'
2020
import type { CascaderProps } from 'antd'
21+
import dayjs from 'dayjs'
22+
23+
// Format date for display (converts ISO8601 to readable format)
24+
const formatDateDisplay = (dateStr: string | undefined): string => {
25+
if (!dateStr) return ''
26+
return dayjs(dateStr).format('YYYY-MM-DD HH:mm:ss')
27+
}
2128

2229
type CascaderOption = NonNullable<CascaderProps['options']>[number]
2330
import { FieldTypeString } from './type_string'
@@ -632,27 +639,27 @@ export const TreeNodeInput = (props: TreeNodeInputProps) => {
632639
<>
633640
<span className="opacity-60">between</span>
634641
<Tag bordered={false} color="blue">
635-
{goal.timeframe_values?.[0]}
642+
{formatDateDisplay(goal.timeframe_values?.[0])}
636643
</Tag>
637644
<span className="opacity-60">&rarr;</span>
638645
<Tag bordered={false} color="blue">
639-
{goal.timeframe_values?.[1]}
646+
{formatDateDisplay(goal.timeframe_values?.[1])}
640647
</Tag>
641648
</>
642649
)}
643650
{goal.timeframe_operator === 'before_date' && (
644651
<>
645652
<span className="opacity-60">before</span>
646653
<Tag bordered={false} color="blue">
647-
{goal.timeframe_values?.[0]}
654+
{formatDateDisplay(goal.timeframe_values?.[0])}
648655
</Tag>
649656
</>
650657
)}
651658
{goal.timeframe_operator === 'after_date' && (
652659
<>
653660
<span className="opacity-60">after</span>
654661
<Tag bordered={false} color="blue">
655-
{goal.timeframe_values?.[0]}
662+
{formatDateDisplay(goal.timeframe_values?.[0])}
656663
</Tag>
657664
</>
658665
)}
@@ -747,27 +754,27 @@ export const TreeNodeInput = (props: TreeNodeInputProps) => {
747754
<>
748755
<span className="opacity-60">between</span>
749756
<Tag bordered={false} color="blue">
750-
{node.leaf?.contact_timeline.timeframe_values?.[0]}
757+
{formatDateDisplay(node.leaf?.contact_timeline.timeframe_values?.[0])}
751758
</Tag>
752759
&rarr;
753760
<Tag className="ml-3" bordered={false} color="blue">
754-
{node.leaf?.contact_timeline.timeframe_values?.[1]}
761+
{formatDateDisplay(node.leaf?.contact_timeline.timeframe_values?.[1])}
755762
</Tag>
756763
</>
757764
)}
758765
{node.leaf?.contact_timeline.timeframe_operator === 'before_date' && (
759766
<>
760767
<span className="opacity-60">before</span>
761768
<Tag bordered={false} color="blue">
762-
{node.leaf?.contact_timeline.timeframe_values?.[0]}
769+
{formatDateDisplay(node.leaf?.contact_timeline.timeframe_values?.[0])}
763770
</Tag>
764771
</>
765772
)}
766773
{node.leaf?.contact_timeline.timeframe_operator === 'after_date' && (
767774
<>
768775
<span className="opacity-60">after</span>
769776
<Tag bordered={false} color="blue">
770-
{node.leaf?.contact_timeline.timeframe_values?.[0]}
777+
{formatDateDisplay(node.leaf?.contact_timeline.timeframe_values?.[0])}
771778
</Tag>
772779
</>
773780
)}

console/src/components/segment/operator_equals.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import { TIMEZONE_OPTIONS } from '../../lib/timezones'
99
import { Languages } from '../../lib/languages'
1010
import dayjs from 'dayjs'
1111

12+
// Format date for display (converts ISO8601 to readable format)
13+
const formatDateDisplay = (dateStr: string | undefined): string => {
14+
if (!dateStr) return ''
15+
return dayjs(dateStr).format('YYYY-MM-DD HH:mm:ss')
16+
}
17+
1218
export type OperatorEqualsProps = {
1319
value: string | undefined
1420
}
@@ -32,7 +38,7 @@ export class OperatorEquals implements IOperator {
3238
value = filter.number_values?.[0]
3339
break
3440
case 'time':
35-
value = filter.string_values?.[0]
41+
value = formatDateDisplay(filter.string_values?.[0])
3642
break
3743
case 'json':
3844
// JSON fields store values in string_values or number_values
@@ -183,7 +189,7 @@ export class OperatorEquals implements IOperator {
183189
getValueProps={(value: string) => {
184190
return { value: value ? dayjs(value) : undefined }
185191
}}
186-
getValueFromEvent={(_date: unknown, dateString: string) => dateString}
192+
getValueFromEvent={(date: dayjs.Dayjs | null) => (date ? date.toISOString() : undefined)}
187193
>
188194
<DatePicker showTime={{ defaultValue: dayjs().startOf('day') }} />
189195
</Form.Item>

console/src/components/segment/operator_time.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import { DimensionFilter, IOperator, Operator } from '../../services/api/segment
33
import Messages from './messages'
44
import dayjs from 'dayjs'
55

6+
// Format date for display (converts ISO8601 to readable format)
7+
const formatDateDisplay = (dateStr: string | undefined): string => {
8+
if (!dateStr) return ''
9+
return dayjs(dateStr).format('YYYY-MM-DD HH:mm:ss')
10+
}
11+
612
const formItemDatetime = (
713
<Form.Item
814
name={['string_values', 0]}
@@ -11,7 +17,7 @@ const formItemDatetime = (
1117
getValueProps={(value: unknown) => {
1218
return { value: value ? dayjs(value as string) : undefined }
1319
}}
14-
getValueFromEvent={(_date: unknown, dateString: string) => dateString}
20+
getValueFromEvent={(date: dayjs.Dayjs | null) => (date ? date.toISOString() : undefined)}
1521
>
1622
<DatePicker showTime={{ defaultValue: dayjs().startOf('day') }} />
1723
</Form.Item>
@@ -29,7 +35,9 @@ const formItemDatetimeRange = (
2935
})
3036
}
3137
}}
32-
getValueFromEvent={(_date: unknown, dateStrings: string[]) => dateStrings}
38+
getValueFromEvent={(dates: [dayjs.Dayjs | null, dayjs.Dayjs | null] | null) =>
39+
dates ? dates.map((date) => (date ? date.toISOString() : undefined)) : undefined
40+
}
3341
>
3442
<DatePicker.RangePicker
3543
showTime={{
@@ -49,7 +57,7 @@ export class OperatorBeforeDate implements IOperator {
4957
<span className="opacity-60 pt-0.5">{this.label}</span>
5058
<span>
5159
<Tag bordered={false} color="blue">
52-
{filter.string_values?.[0]}
60+
{formatDateDisplay(filter.string_values?.[0])}
5361
</Tag>
5462
</span>
5563
</>
@@ -71,7 +79,7 @@ export class OperatorAfterDate implements IOperator {
7179
<span className="opacity-60 pt-0.5">{this.label}</span>
7280
<span>
7381
<Tag bordered={false} color="blue">
74-
{filter.string_values?.[0]}
82+
{formatDateDisplay(filter.string_values?.[0])}
7583
</Tag>
7684
</span>
7785
</>
@@ -93,11 +101,11 @@ export class OperatorInDateRange implements IOperator {
93101
<span className="opacity-60 pt-0.5">{this.label}</span>
94102
<span>
95103
<Tag bordered={false} color="blue">
96-
{filter.string_values?.[0]}
104+
{formatDateDisplay(filter.string_values?.[0])}
97105
</Tag>
98106
&rarr;
99107
<Tag bordered={false} className="ml-3" color="blue">
100-
{filter.string_values?.[1]}
108+
{formatDateDisplay(filter.string_values?.[1])}
101109
</Tag>
102110
</span>
103111
</>
@@ -119,11 +127,11 @@ export class OperatorNotInDateRange implements IOperator {
119127
<span className="opacity-60 pt-0.5">{this.label}</span>
120128
<span>
121129
<Tag bordered={false} color="blue">
122-
{filter.string_values?.[0]}
130+
{formatDateDisplay(filter.string_values?.[0])}
123131
</Tag>
124132
&rarr;
125133
<Tag bordered={false} className="ml-3" color="blue">
126-
{filter.string_values?.[1]}
134+
{formatDateDisplay(filter.string_values?.[1])}
127135
</Tag>
128136
</span>
129137
</>

0 commit comments

Comments
 (0)