Skip to content

Investigate time zone handling in permalink date formatting #63

@osteele

Description

@osteele

Description

There's a potential inconsistency in how time zones are handled in permalink date formatting. The current implementation uses the local time zone when formatting dates in permalinks:

date = p.PostDate().In(time.Local)

This means that the same content will generate different permalinks depending on the local time zone of the machine running the code. For example, a post with a UTC date of February 3 will have a permalink with "02/03" in UTC time zones, but "02/04" in UTC+9 (Japan) time zones.

Investigation Needed

  1. Determine how Jekyll handles time zones in permalinks. Does it use UTC consistently, or does it also use the local time zone?
  2. Decide whether gojekyll should match Jekyll's behavior or adopt a more consistent approach (e.g., always using UTC).

Current Workaround

The tests have been updated to expect dates in the local time zone, but this is just a temporary fix. The real solution depends on what behavior we want to standardize on.

Potential Solutions

  1. If Jekyll uses UTC: Modify permalinks.go to use date = p.PostDate().UTC() instead of date = p.PostDate().In(time.Local)
  2. If Jekyll uses local time: Keep the current implementation but document this behavior clearly
  3. Make the time zone configurable in the site configuration

Related Files

  • pages/permalinks.go - Contains the current implementation
  • pages/permalinks_test.go - Contains tests that were updated to accommodate local time zone

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions