Hi,
I am encountering an issue with how timestamp headers are serialized in
Kafka Connect and would appreciate clarification on whether this is the
intended behavior or a bug.
Problem: Incorrect Serialization of Midnight UTC Timestamps
When using connectors that produce timestamp headers (e.g., the MongoDB
source connector), timestamps that fall exactly at midnight UTC are being
serialized incorrectly, losing their time component. Timestamps at any
other time of day are serialized correctly.
Example:
- Input Timestamp: 2025-01-01T00:00:00.000Z (midnight UTC)
- Expected Serialized Value: "2025-01-01T00:00:00.000Z"
- Actual Serialized Value: "2025-01-01" (time component lost)
Analysis
I traced this to the org.apache.kafka.connect.data.Values.dateFormatFor()
< https://github.com/apache/kafka/blob/0e1c6fb6bb503aeda27ce1d73cd827b7a227d769/connect/api/src/main/java/org/apache/kafka/connect/data/Values.java#L769-L777 >
which
determines the format...