Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Seperate Date and Time format functions #71

Open
hexagonal-sun opened this issue May 24, 2021 · 3 comments
Open

RFC: Seperate Date and Time format functions #71

hexagonal-sun opened this issue May 24, 2021 · 3 comments
Labels
type: enhancement A new feature or addition.

Comments

@hexagonal-sun
Copy link

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?

@garyb
Copy link
Member

garyb commented May 24, 2021

Maybe there is a more elegant solution involving type classes?

I don't think there is really, it's still going to need to be reified into types at some point. Constructing the formats could perhaps be made easier using some Inject style classes on top, but I think it'd be fine without too probably.

@thomashoneyman thomashoneyman added type: enhancement A new feature or addition. help wanted labels May 24, 2021
@wclr
Copy link

wclr commented Jul 15, 2021

Would be nice to have ready-to-go formatters for Date and Time types.

@CarstenKoenig
Copy link
Contributor

sorry - I did link the wrong issue - please ignore the last message here :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A new feature or addition.
Development

No branches or pull requests

6 participants