Skip to content

TimeUtil changes time zone when parsing ZonedDateTime #422

@sebastian-peter

Description

@sebastian-peter

Given a ZonedDateTime with a time zone other than UTC, TimeUtil.toZonedDateTime returns a wrong result. It discards the time zone within the String with the time zone set within TimeUtil.

The following test fails, but should succeed:

	def "A TimeUtil should parse ZonedDateTime objects with time zone correctly"() {
		given:
		def time = TimeUtil.withDefaults.toZonedDateTime("2020-04-22T00:00:00+01:00")

		expect:
		DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(time) == "2020-04-22T00:00:00+01:00"
	}

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions