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

how to change cbc:IssueTime formats #40

Closed
ssdf34 opened this issue Sep 19, 2021 · 13 comments
Closed

how to change cbc:IssueTime formats #40

ssdf34 opened this issue Sep 19, 2021 · 13 comments
Assignees
Labels

Comments

@ssdf34
Copy link

ssdf34 commented Sep 19, 2021

Hi,
How I can change cbc:IssueTime formats from cbc:IssueTime17:18:50.0</cbc:IssueTime>
to cbc:IssueTime17:18:50</cbc:IssueTime> whiteout nanosecond?

@phax phax self-assigned this Sep 19, 2021
@phax phax added the question label Sep 19, 2021
@phax
Copy link
Owner

phax commented Sep 19, 2021

This is an issue that occurs from Java 9 on, if I remember correctly.
The key point here is to limit the precision on any time and dateTime object to milliseconds. I am e.g. using dt.truncatedTo (ChronoUnit.MILLIS) internally.

@ssdf34
Copy link
Author

ssdf34 commented Sep 19, 2021

Thank you for your fast replay but when I use LocalTime InviceIssiuTime_S = LocalTime.now();
aInvoice.setIssueTime(InviceIssiuTime_S.truncatedTo(ChronoUnit.MILLIS));
I got cbc:IssueTime17:43:08.498</cbc:IssueTime>
when I use LocalTime InviceIssiuTime_S = LocalTime.now();
aInvoice.setIssueTime(InviceIssiuTime_S.truncatedTo(ChronoUnit.SECONDS));
I got cbc:IssueTime17:51:34.0</cbc:IssueTime>
and I remove ".0" from IssueTime

@ssdf34
Copy link
Author

ssdf34 commented Sep 19, 2021

How I can remove ".0" from the last

@phax
Copy link
Owner

phax commented Sep 19, 2021

Ah you mean, you want to totally remove the fraction seconds part....
May I ask why? Syntactically that is totally fine and it makes semantically no difference.....
(I can't think of any quick fix for this)

@ssdf34
Copy link
Author

ssdf34 commented Sep 19, 2021

because it is requirement in our country in UBL evince

@phax
Copy link
Owner

phax commented Sep 19, 2021

Technically stupid requirement but okay.
Can you try

aInvoice.setIssueTime(InviceIssiuTime_S.truncatedTo(ChronoUnit.MINUTES));

@phax
Copy link
Owner

phax commented Sep 19, 2021

doesn't work

@phax
Copy link
Owner

phax commented Sep 19, 2021

Bug on my side.... :(

phax referenced this issue in phax/ph-commons Sep 19, 2021
@ssdf34
Copy link
Author

ssdf34 commented Sep 19, 2021

When I try aInvoice.setIssueTime(InviceIssiuTime_S.truncatedTo(ChronoUnit.MINUTES));
I have got

cbc:IssueTime19:05**:00.0**</cbc:IssueTime>

@phax
Copy link
Owner

phax commented Sep 19, 2021

Yes yes - as I mentioned previously it's a bug on my side. Working on it

@phax
Copy link
Owner

phax commented Sep 19, 2021

Please update your "ph-commons" dependency to 10.1.3 (assuming you use the latest ph-ubl version) to resolve the issue

@ssdf34
Copy link
Author

ssdf34 commented Sep 20, 2021

Thank you It is working fine now and I appreciate your kind cooperation and quick response

@ssdf34 ssdf34 closed this as completed Sep 20, 2021
@phax
Copy link
Owner

phax commented Sep 20, 2021

Great - thanks for testing. I will create an updated 6.6.3 release to avoid that manual cause!

phax added a commit that referenced this issue Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants