Skip to content

RFC: Seperate Date and Time format functions #71

Description

@hexagonal-sun

Hi,

It would be nice if functions for formatting Date and Time types exist. Currently, if one wants to format a Date, a dummy Time value needs to be be created to convert to a DateTime for formatting; likewise for the Time type.

I'm not exactly sure what the best way to do this would be. Maybe:

data PlacholderFormatterCommand = Placeholder String

data DateFormatterCommand
  = YearFull
  | YearTwoDigits
  | YearAbsolute
  | MonthFull
    [...]
  | PlaceholderFormatterCommand

data TimeFormatterCommand
  = [...]
  | PlaceholderFormatterCommand

data DateTimeFormatterCommand
  = DateFormatterCommand
  | TimeFormatterCommand

The main issue I see with this approach are FormatterCommands that are applicable to both Dates and Times, namely Placeholder and UnixTimestamp. Maybe there is a more elegant solution involving type classes?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions