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

Has anyone gotten this working on alpine linux? #94

Open
bdentino opened this issue May 28, 2016 · 7 comments
Open

Has anyone gotten this working on alpine linux? #94

bdentino opened this issue May 28, 2016 · 7 comments

Comments

@bdentino
Copy link

Having trouble running a node app that uses this library in an alpine-based docker container, as I'm getting the 'unknown timezone' error. Debug output shows it's trying to find a proper zoneinfo directory and failing to do so. Most likely because of this: https://wiki.alpinelinux.org/wiki/Alpine_Linux:FAQ#How_do_I_set_the_local_timezone.3F

Is there any chance of this being supportable on alpine? I'd submit a PR if someone could point me in the right direction, but not sure if it's even feasible without significant rewrites.

@Yumonra07
Copy link

@bdentino I'm having the same issue. Did you get any further with this issue?

@Yumonra07
Copy link

Yumonra07 commented Oct 28, 2016

Running apk add --update tzdata and setting the TZ env variable to a valid timezone solves the issue.

@dettoni
Copy link

dettoni commented Mar 13, 2017

We tried to use use here on Alpine and find out that tzset has different results between musl glibc (alpine) and ubuntu glibc.

#include <stdio.h>
#include <time.h>
void main()
{
  tzset();
  printf("daylight = %d tz[0] = [%s] tz[1] = [%s] timezone = [%ld]\n", daylight, tzname[0], tzname[1], timezone);
}

This simple snippet will print:

tzname[1] = tzname[0] for Ubuntu in time zones without Daylight Saving Time.
tzname[1] = "" for Alpine in time zones without Daylight Saving Time.

When the time zone has Daylight Saving Time, it will return the name for the time zone when Daylight Saving Time is in use for both.

Based on this link, I believe that musl glibc is correct and you should not use tzname[1] to validate the time zone, but I am not sure about this.

@jaydp17
Copy link

jaydp17 commented Jun 29, 2017

@TooTallNate I see that there has been a commit (2739eac) regarding alpine.
If it's working, can you please release a new version?

@jaydp17
Copy link

jaydp17 commented Jul 12, 2017

That commit doesn't seem to fix the issue.

@TooTallNate here's the debug ouput I get on alpine

time Date#setTimezone(UTC, undefined) +21s
time current timezone is not "UTC", calling tzset() +1ms
time set the current timezone to: +0ms UTC
time got bad zoneinfo object: +0ms { tzname: [ 'UTC', '' ], timezone: 0, daylight: 0 }
Error: Unknown Timezone: 'UTC'
    at Function.tzset (/src/node_modules/time/index.js:160:15)

@Ilhicas
Copy link

Ilhicas commented Jul 28, 2017

This is not related to this library, node or other languages, for some reason someone thumbed down @Yumonra07 answer, on install tzdata, and that solves the issue, on other languages as well such as python for instance.

@comster
Copy link

comster commented Nov 27, 2017

Hey guys,

This issue is still open it seems? My best attempt at the previous two solutions didn't seem to work for me, still getting the 'unknown timezone' error for UTC.

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

6 participants