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

Timezone database error (Europe/Budapest) #450

Closed
fzoli opened this issue Feb 26, 2017 · 3 comments
Closed

Timezone database error (Europe/Budapest) #450

fzoli opened this issue Feb 26, 2017 · 3 comments

Comments

@fzoli
Copy link

fzoli commented Feb 26, 2017

Description of the Issue and Steps to Reproduce:

I think I have just found a timezone database parse(?) error.

moment.tz("1890-01-01 00:00", "Europe/Paris").format()
// "1890-01-01T00:00:00+00:09" // OK

moment.tz("1890-01-01 00:00", "Europe/Bucharest").format()
// "1890-01-01T00:00:00+01:44" // OK

moment.tz("1890-01-01 00:00", "Europe/Budapest").format()
// "1890-01-01T00:00:00+01:00" // WRONG
// It should be "1890-01-01T00:00:00+01:16:20" (or at least +01:16)

moment.tz('1890-01-01 01:16:20', 'Europe/Budapest').clone().tz('UTC').format()
// "1890-01-01T00:16:20Z" // WRONG
// It should be "1890-01-01T00:00:00Z"

From the tzdb-2016j:

Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
Zone	Europe/Budapest	1:16:20 -	LMT	1890 Oct

It means, the tzdb is correct.
I guess the JS code is correct and the tzdb parser should be fixed (cause other time-zones are well-parsed).

Environment:
Chrome 55 on Ubuntu 14.04.5 LTS
System timezone: Europe/Budapest

console.log( (new Date()).toString()) // Sun Feb 26 2017 11:19:46 GMT+0100 (CET)
console.log((new Date()).toLocaleString()) // 2017. 02. 26. 11:19:46
console.log( (new Date()).getTimezoneOffset()) // -60
console.log( navigator.userAgent) // Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
console.log(moment.version) // 2.17.1
@mattjohnsonpint
Copy link
Contributor

I believe this is a dup of #308

@fzoli
Copy link
Author

fzoli commented Feb 28, 2017

I don't agree.

Explain this.

Moment

moment('1890-01-01T00:00:00Z').clone().tz('Europe/Paris').format()
// "1890-01-01T00:09:21+00:09" // CORRECT

moment('1890-01-01T00:00:00Z').clone().tz('Europe/Budapest').format()
// "1890-01-01T01:00:00+01:00" // WRONG
// It should be "1890-01-01T01:16:20+01:16"

Java DateTime API

@Test
public void testParisTime() {
    ZonedDateTime parisTime = OffsetDateTime.parse("1890-01-01T00:00:00Z").atZoneSameInstant(ZoneId.of("Europe/Paris"));
    Assert.assertEquals("1890-01-01T00:09:21+00:09:21", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(parisTime));
}

@Test
public void testBudapestTime() {
    ZonedDateTime budapestTime = OffsetDateTime.parse("1890-01-01T00:00:00Z").atZoneSameInstant(ZoneId.of("Europe/Budapest"));
    Assert.assertEquals("1890-01-01T01:16:20+01:16:20", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(budapestTime));
}

@fzoli
Copy link
Author

fzoli commented Feb 28, 2017

Cause I can not reopen this issue, I created a new one:
#451

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

No branches or pull requests

2 participants