Skip to content

Align ISO timezone parsing in DateFormatter with Joda-Time / JSR-310 [SPR-14675] #19239

Closed
@spring-projects-issues

Description

@spring-projects-issues

Per Holmberg opened SPR-14675 and commented

First, the javadoc example for DateTimeFormat.ISO.DATE_TIME is wrong; literal 'T' should be used between date and time. But even when this corrected it does not work:

DateFormatter formatter = new DateFormatter();
formatter.setIso(DateTimeFormat.ISO.DATE_TIME);
formatter.parse("2000-10-31T01:30:00.000-05:00", Locale.getDefault());

Reason is the pattern specified in DateFormatter is wrong; for ISO, X should be used for timezone instead of Z (se javadoc for SimpleDateFormat). Correct pattern: yyyy-MM-dd'T'HH:mm:ss.SSSXXX

I guess same applies to DateTimeFormat.ISO.TIME.


Affects: 4.2.7, 4.3.2

Issue Links:

Referenced from: commits bb94ba6, db196ce, a5070d5, 68332bf, d5c9cc6

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions