-
Notifications
You must be signed in to change notification settings - Fork 10
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
add support of Date type. #14
Comments
The methods |
Good to know. Thx @peteroupc 🙏 |
(Just an idea, maybe a method |
I see the default way to encoding date is to use String (tag 0) |
I guess I maybe find a bug (I'm not sure at all) obj = CBORObject.FromObjectAndTag(date.getTime(), 1); instead of obj = CBORObject.FromObject(date); Tell me if I'm wrong. If do that, I face an issue because this can not be decoded using : Date date = obj.ToObject(Date.class); I face :
I guess maybe the issue is in : static boolean IsNumber(CBORObject o) {
if (IsUntaggedInteger(o)) {
return true;
} else if (!o.isTagged() && o.getType() == CBORType.FloatingPoint) {
return true;
... ... In my case this is a taggedInteger and so isNumber return |
Yes, this should have been supported better: "If the type is DateTime (or Date in Java) , returns a date/time object if the CBOR object's outermost tag is 0 or 1." |
This is pretty much implemented in CBORDateConverter but it seems there is a bug. 😬 Not directly linked to this bug, but my 2 cents about improving Date API. CBORObject.isDate();
CBORObject.asDate();
CBORObject.fromDateAsString(date);
CBORObject.fromDateAsTimestamp(date); I think (Just in case I begin some comparison between Jackson and CBOR-JAVA : eclipse-leshan/leshan#939) |
I have updated this repository to fix the bug in CBORDateConverter. The suggestion in your last comment might not be implemented until the next major version (which might not happen in a while) for backward compatibility reasons. (To be clear, the next version I expect to release is version 4.3, which is a minor version.) |
No problem, there is no urgency for this. (This is just some improvement ideas)
Thx 🙏 for your time ! |
Should we close this issue and I create a dedicated one for "date API improvement" or we just keep this one open ? |
Now the CBORDateConverter was made public and expanded. This issue can now be closed. |
I'm not sure if changes proposed at #14 (comment) was added ? |
This is the new CBORDateConverter: https://github.com/peteroupc/CBOR-Java/blob/master/src/main/java/com/upokecenter/cbor/CBORDateConverter.java . It includes the following new methods:
|
Ok, this will be available in which version? |
I expect to include that feature in the next minor version, namely version 4.4. |
Ok, thx 🙏 |
Maybe I'm wrong but It seems to me currently there is no support for Date type.
Is it something planned to support date like defined in RFC7049§2.4.1 ?
The text was updated successfully, but these errors were encountered: