I have a site for a tutorial that my team delivers. We create a page for each event. The events are usually associated with conferences, and each one has a different natural time zone for things like start and end times. I specify them in the front matter with the appropriate time zone offsets, but Jekyll forces everything into the site’s time zone per _config.yml. I’d really like to be able to use Jekyll’s time and data formatting capabilities but be able to force the output to be in the time zone I specified. Is there any way to do this? Thanks
One option would be to copy and extend Jekyll builtin date
filters with a plugin in _plugins
to support a timezone parameter.
Would you consider storing the value as a plain text in such a format that Jekyll doesn’t convert it into a date?
Or store the date and time separately so you can use order events by date and then use time for display purposes only
Perhaps
---
date: 2019-02-03
time: |
7PM EST
---
- Date: {{ page.date | date_to_string }}
- Time: {{ page.time }}
Result
- Date: 23 Febr 2019
- Time: 7PM EST
Of course you can’t do calculations or comparisons with a text time but if all you do is format is then it should be good.
You could always duplicate the time field in the date if you want to have 2 events on the same day and sort by that field.
---
datetime: 2019-02-03 19:00 -06 etc.
time: |
7PM EST
---
And you can even put multiple times in as a list. With manual effort.
---
time:
- 7PM EST
- 10PM ...
---
Thanks for the suggestion Chuck. If I were more familiar with Ruby, I might consider this. But glancing at the code for Jekyll’s filters, they seem to be pretty much direct calls to Ruby functions and appears to largely be relying on how Ruby processes time zones. From a quick look at the relevant (I think) Ruby docs, I didn’t see anything about forcing strftime and friends to operate in particular timezones of my choosing.
Thanks Michael. After some thought, I think I can live with this solution and will go this route.