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

try to fix issue #2501 #2502

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

TungMan0801
Copy link

In #2501 , 发现了很多基于LocalDate无论是格式转换还是时区转换都有的问题
并且不能通过指定local来做出有效修改,甚至没有影响
所以针对DateUtil这一段增添了parseLocalDateTimeWithZoneID(String dateString, String dateFormat, String local)的代码
对比原先的parseLocalDateTime(String dateString, String dateFormat, Locale local), 原先的缺点是:

  1. 只支持输入国家id,并且仅支持十几个国家,调用后也没有成功基于时区作出修改,返回值仍未默认值。
  2. DateFormat的指定失败,对于长度不足的日期无法完成formatparse,这是使用的DateTimeFormatter.ofPattern时的局限性。(这并非是parseDate和paseLocalDateTime的通病,因为parseDate使用的方法是“getCacheDateFormat(dateFormat).parse(dateString);”,于是指定DateFormat后可完成长度不足的parse,而parseLocalDateTime并不是,所以算是一个新的bug。)

作出修改后,后者可以完成以下功能

  1. DateFormat指定后,可使用区域覆盖到长度不足的时间。比如2022-1-1
  2. 以指定的时区号作为时区调整,24个时区皆覆盖。local示例:“EST”,"CST”

另将ConverterDataTest的示例做出调整修改。

@TungMan0801 TungMan0801 changed the title try to fix issue#2501 try to fix issue https://github.com/alibaba/easyexcel/issues/2501 May 28, 2022
@TungMan0801 TungMan0801 changed the title try to fix issue https://github.com/alibaba/easyexcel/issues/2501 try to fix issue #2501 May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant