Skip to content

Manual date_style of fmt_date() #612

Closed

Description

@msberends

Thanks for this package!

I personally think the date_style argument of the fmt_date() function is not very intuitive, since you have to input a number for the desired format and have to look up the meaning using another function (info_date_style()). Aside from non-human-readable syntax, it brings a great and undesirable need to have unnecessarily complicated documentation.

To improve convenience, I would suggest to allow human-readable formats. I was thinking of that one thing Excel is good at:

gt() %>%
  fmt_date(date_style = "ddd, dd mmmm yyyy")

An example of an implementation to transform e.g. "ddd, dd mmmm yyyy" to "%a, %d %B %Y" is available in the cleaner package: cleaner/R/format_datetime.R

Activity

  1. rich-iannone commented on Apr 27, 2021

    @rich-iannone
    Member

    I do feel that the fmt_date() et al. functions are quite limited in their simplicity. It would be great to revisit these formatters and allow for more precise ways of defining dates and times. Furthermore, the functions lack locale support, and that bothers me a lot (we can't get a formatted date/time in French, for example).

  2. self-assigned this
    on Apr 27, 2021
  3. added this to the v0.4.0 milestone on Apr 27, 2021
  4. rich-iannone commented on Jun 19, 2021

    @rich-iannone
    Member

    Note: a strftime() formatting option will be added to fmt_datetime() with a new argument. This issue will be associated with an ongoing PR that addresses fixed/enhances for the date/time formatters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions