Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rcunn87
Copy link

@rcunn87 rcunn87 commented Apr 19, 2022

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
Copy link
Author

rcunn87 commented Apr 19, 2022

@mgrumbach This is the reopened PR

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

rcunn87 commented Jun 21, 2022

@shireennagdive @mgrumbach ?

@@ -66,6 +67,8 @@ public class TypeMapper {
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");
Copy link
Contributor

@mgrumbach mgrumbach Aug 4, 2022

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.

Copy link
Author

@rcunn87 rcunn87 Aug 12, 2022

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
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