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

fastjson夏令时期间Date转换导致时区错误问题 #1878

Closed
xiaoxiaoyiwai opened this issue May 28, 2018 · 1 comment
Closed

fastjson夏令时期间Date转换导致时区错误问题 #1878

xiaoxiaoyiwai opened this issue May 28, 2018 · 1 comment
Labels
Milestone

Comments

@xiaoxiaoyiwai
Copy link

我们发现在使用fastjson(包括最版版本的fastjson)的方法: JSON.toJSONString(date, SerializerFeature.UseISO8601DateFormat) 做Date->String的转换时没有考虑夏令时, 所以会导致在洛杉矶时区中在夏令时期间做此转换会不符合业务预期.

(1)fastjson获取毫秒偏移的方法为:calendar.getTimeZone().getRawOffset(),而getRawOffset()是不考虑夏令时。

(2)javax中的原生方法获取毫秒偏移方法为:calendar.getTimeZone().getOffset(long date),getOffset(long date)方法会考虑夏令时。

具体可以见之前转的邮件"fastjson夏令时期间Date转换导致时区错误问题分析"

@wenshao wenshao added the bug label May 29, 2018
@wenshao wenshao added this to the 1.2.49 milestone May 29, 2018
@wenshao
Copy link
Member

wenshao commented Aug 5, 2018

https://github.com/alibaba/fastjson/releases/tag/1.2.49
问题已修复,请用新版本

@wenshao wenshao closed this as completed Aug 5, 2018
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