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) - 2 #451

Closed
fzoli opened this issue Feb 28, 2017 · 2 comments
Closed

Timezone database error (Europe/Budapest) - 2 #451

fzoli opened this issue Feb 28, 2017 · 2 comments

Comments

@fzoli
Copy link

fzoli commented Feb 28, 2017

Description of the Issue and Steps to Reproduce:

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

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));
}

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 also correct and the tzdb parser should be fixed (cause 'Europe/Paris' time-zone is 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
@maggiepint
Copy link
Member

Yes. this is a duplicate of #308. If you use a more current date, not a date that falls in local mean time, everything works.

@fzoli
Copy link
Author

fzoli commented Feb 28, 2017

Indeed, this is a duplicate. Based on @mj1856's comment, the LMT record is missing.
Thanks for the fast response :)

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