Skip to content

Instantly share code, notes, and snippets.

@pithu
Created May 25, 2017 07:19
Show Gist options
  • Save pithu/a37f481b257f34774faf3eaa75be7f2b to your computer and use it in GitHub Desktop.
Save pithu/a37f481b257f34774faf3eaa75be7f2b to your computer and use it in GitHub Desktop.
Test case for js-joda/js-joda#166
import java.time.*
// import org.threeten.bp.*
def data_dst_samples = [
// overlap
['2017-11-05T01:00:00-07:00[America/Los_Angeles]', '2017-11-05T08:00:00Z'],
['2017-11-05T01:00:00-08:00[America/Los_Angeles]', '2017-11-05T08:00:00Z'],
['2017-11-05T02:00:00-08:00[America/Los_Angeles]', '2017-11-05T10:00:00Z'],
['2016-11-06T01:00-04:00[America/New_York]', '2016-11-06T05:00:00Z'],
['2016-11-06T01:00-05:00[America/New_York]', '2016-11-06T05:00:00Z'],
['2016-11-06T01:30-04:00[America/New_York]', '2016-11-06T05:30:00Z'],
['2016-11-06T01:30-05:00[America/New_York]', '2016-11-06T05:30:00Z'],
['2016-11-06T02:00-04:00[America/New_York]', '2016-11-06T07:00:00Z'],
['2016-11-06T02:00-05:00[America/New_York]', '2016-11-06T07:00:00Z'],
['2016-10-30T02:00+02:00[Europe/Berlin]', '2016-10-30T00:00:00Z'],
['2016-10-30T02:00+03:00[Europe/Berlin]', '2016-10-30T00:00:00Z'],
['2016-10-30T02:30+02:00[Europe/Berlin]', '2016-10-30T00:30:00Z'],
['2016-10-30T02:30+03:00[Europe/Berlin]', '2016-10-30T00:30:00Z'],
['2016-10-30T03:00+02:00[Europe/Berlin]', '2016-10-30T02:00:00Z'],
['2016-10-30T03:00+03:00[Europe/Berlin]', '2016-10-30T02:00:00Z'],
]
for(sample in data_dst_samples) {
def instant = Instant.parse(sample[1])
def zdtInstant = ZonedDateTime.parse(sample[0]).toInstant()
println("${zdtInstant}: ${zdtInstant.equals(instant)}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment