hhvm / hsl-experimental

Experimental features for the Hack Standard Library
MIT License
23 stars 10 forks source link

[ DateTime ] The format parameter being a format string limits the use of creating constants #187

Open lexidor opened 3 years ago

lexidor commented 3 years ago

I'd like to be able to create a constant with a particular format with a useful name. TIME_FMT_MYSQL = ...; TIME_FMT_DISPLAY_INTERNATIONAL = ...; TIME_FMT_CLOCK(12|24)H = ... This is not possible with the current API design.

Alternatives: I could declare datetime_fmt(DateTime, MyOwnEnum): string; in my own code. Internally switch over the enum and pass the string literal format string. Clunky, but it works.