aperezdc / ngx-fancyindex

Fancy indexes module for the Nginx web server
Other
857 stars 127 forks source link

Feature Request: fancyindex_time_format timezone support #123

Open cinderblock opened 3 years ago

cinderblock commented 3 years ago

I think this awesome module deserves a couple more functions relating to time, specifically around displaying time in non GMT zones.

Some ideas that I think would be nice to implement, in order of presumed simplicity of implementation:

  1. Support %Z option of strftime (and maybe %z)
  2. Serve page with GMT time and convert to local time with Javascript on client browser
  3. Button to let viewers select which time zone they want to use and stored in a cookie
ryandesign commented 2 years ago
  1. Support %Z option of strftime (and maybe %z)

Seems like that would be possible, although this information is not available on all platforms. nginx has a feature test for it and defines NGX_HAVE_GMTOFF if the information is available.

%z (the hour and minute offset from UTC) is in tm_gmtoff while %Z (the timezone or name or abbreviation) is in tm_zone.

  1. Serve page with GMT time and convert to local time with Javascript on client browser
  2. Button to let viewers select which time zone they want to use and stored in a cookie

ngx-fancyindex already gives you everything you need to write the HTML, CSS, and JavaScript to do these things.