Milestone的TargetDate与自定义DateTime字段同一日期存储差异问题
Why Rally's Milestone TargetDate and Custom DateTime Fields Store Dates Differently
Great question! The difference you're seeing comes down to a core distinction between Rally's built-in TargetDate field and custom DateTime fields in the Milestone object model—here's a breakdown:
1. Field Type & Intended Purpose
- Built-in
TargetDate: This field is actually a Date-only type, not a full DateTime. Even though you can pass an ISO DateTime string (like2018-04-06T00:00:00.000Z) to it via the API, Rally automatically strips off the time and timezone components. It then aligns the date to the workspace's default timezone before storing it. For example, if your workspace uses a timezone like UTC-5, the UTC midnight timestamp you passed would translate to April 5th 19:00 local time, so Rally would store2018-04-05as the TargetDate. - Custom DateTime Field: This is a true DateTime type, designed to store full timestamp information including time and timezone. Rally will either preserve the original timezone from your input or convert it to the platform's server timezone (usually UTC) for storage, retaining the complete timestamp data.
2. How to Verify the Difference
You can confirm this behavior by querying the Milestone via the Rally API:
- The
TargetDatevalue will return as a plain date string (e.g.,2018-04-06or adjusted to your workspace timezone's date). - The custom DateTime field will return the full ISO timestamp (e.g.,
2018-04-06T00:00:00.000Zor the converted server timezone equivalent).
In the Rally UI, you'll also notice:
TargetDateuses a simple date picker with no time input option.- Custom DateTime fields show a date + time selector, reflecting the full stored timestamp.
3. How to Align the Values (If Needed)
If you want your custom field to match TargetDate's behavior:
- Change the custom field's type from DateTime to Date (this will strip time data automatically, just like TargetDate).
- Or, when sending data to the custom field, manually truncate the timestamp to just the date component (e.g., pass
2018-04-06instead of the full ISO string).
If you need to retain time information, stick with the custom DateTime field and treat TargetDate as a separate date-only marker for milestone tracking.
内容的提问来源于stack exchange,提问作者Sarita
相关产品推荐
相关产品推荐

