Skip to content

Allow a timezone configuration for partial date handling #9

@mshick

Description

@mshick

Currently, if I set a field to the date type and enter a partial date, e.g., 2021-10-21 I'm given a date object initialized with a value in UTC, like this 2021-10-21T00:00:00.000Z. Ideally I'd be able to have that partial date interpreted correctly for my timezone — I'm in America/New_York so I'd like to see 2021-10-21T04:00:00.000Z.

A possible, straightforward solution would be the date-fns-tz libraries zonedTimeToUtc function and an optional IANA timezone in the contentlayer config. E.g.

zonedTimeToUtc(doc.createdAt, opts.timezone)

If you're interested in a contribution I could work on a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions