Skip to content

Fixes the issue where the toString of OffsetDateTime truncates trailing 0's#297

Open
rcunn87 wants to merge 1 commit into
forcedotcom:masterfrom
rcunn87:fixOffsetDateTimeFormat
Open

Fixes the issue where the toString of OffsetDateTime truncates trailing 0's#297
rcunn87 wants to merge 1 commit into
forcedotcom:masterfrom
rcunn87:fixOffsetDateTimeFormat

Conversation

@rcunn87

@rcunn87 rcunn87 commented Apr 19, 2022

Copy link
Copy Markdown

By default OffsetDateTime will truncate trailing Zeros from its toString representation, this change ensures that the trailing zeros will not be truncated

The truncated 0 was causing updates to get rejected because they were not a valid format

@rcunn87

rcunn87 commented Apr 19, 2022

Copy link
Copy Markdown
Author

@mgrumbach This is the reopened PR

@rcunn87 rcunn87 force-pushed the fixOffsetDateTimeFormat branch from f2cea51 to 3fa3471 Compare April 21, 2022 15:16
@rcunn87

rcunn87 commented Jun 21, 2022

Copy link
Copy Markdown
Author

@shireennagdive @mgrumbach ?

private static final HashSet<String> keywords = getKeyWords();
private static HashMap<String, Class<?>> primitiveClassCache = getPrimitiveClassCache();

private static final DateTimeFormatter DTF = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX");

@mgrumbach mgrumbach Aug 4, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the final X correct? If the OffsetDateTime value always has zero offset, then this should work. However, if non-zero offsets are possible, then we probably want XXX to match Salesforce. Note that OffsetDateTime.toString() uses XXXXX.

@rcunn87 rcunn87 Aug 12, 2022

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I was encountering was that OffsetDataTime.toString uses the shortest of what whats listed in the javadoc, and then salesforce was rejecting the data.
Let me change it and give it a test

@mgrumbach

Copy link
Copy Markdown
Contributor

Hi @rcunn87 , can you provide the steps you are using to reproduce the issue you are seeing? If you could create an "Issue" that describes the issue and steps to reproduce, and then link it to this PR, that would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants