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

[QUESTION] 发现有两种日期date格式不支持(12-hour clock 12小时制和CLDR) #2635

Closed
qinbohan opened this issue May 28, 2024 · 2 comments
Labels
fixed question Further information is requested
Milestone

Comments

@qinbohan
Copy link

qinbohan commented May 28, 2024

String str1 = ""May 28, 2024 12:10:10 PM"";
System.out.println(com.alibaba.fastjson2.JSON.parseObject(str1, Date.class));
String str2 = ""Apr 2, 2024, 2:13:04 PM"";
System.out.println(com.alibaba.fastjson2.JSON.parseObject(str2, Date.class));

fastjson对这两种日期格式的反序列化好像都不支持。
第一个是12小时制的中午12点10分的表示方式,fastjson支持解析“May 28, 2024 00:10:10 PM”,无法解析“May 28, 2024 12:10:10 PM”但实际后者才是正确表达方式。
第二个是JDK9以后默认使用CLDR日期格式,与我们之前常用的相比,年份的后面多了个逗号,fastjson能解析“Apr 2, 2024 2:13:04 PM”,但无法解析“Apr 2, 2024, 2:13:04 PM”

@qinbohan qinbohan added the question Further information is requested label May 28, 2024
@wenshao wenshao added this to the 2.0.51 milestone May 28, 2024
@wenshao wenshao added the fixed label May 29, 2024
@wenshao
Copy link
Member

wenshao commented May 29, 2024

https://oss.sonatype.org/content/repositories/snapshots/com/alibaba/fastjson2/fastjson2/2.0.51-SNAPSHOT/
问题已修复,请帮忙用2.0.51-SNAPSHOT版本验证

@wenshao
Copy link
Member

wenshao commented Jun 1, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.51
请用新版本

@wenshao wenshao closed this as completed Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants