Skip to content

Instantly share code, notes, and snippets.

@fredemmott
Created November 11, 2022 21:54
Show Gist options
  • Select an option

  • Save fredemmott/cab64bd5d3be051e0480c94f2aa5e145 to your computer and use it in GitHub Desktop.

Select an option

Save fredemmott/cab64bd5d3be051e0480c94f2aa5e145 to your computer and use it in GitHub Desktop.
TIme\now(): mono
Time\now_unix() unix
mono - not guaranteed to be comparable between machines?
… vs …
DateTime::getTimestamp() - unix? would expect mono for consistency with now()
Naming: Timestamp vs timepoint. ‘timestamp’ can imply unix
“omitted because they vary in length”: plugMonths, plusYears; ‘plusDays’ explicitly does not respect DST
‘setHour’ is unpredicatable in zoned timestamps, and rounds. There are several callouts to the need to explicitly document edge cases. Perhaps ‘approximatelySetHour’ would be better
‘nextDay(Time\Tuesday)’ ‘// TODO: DST can probably mess this up, make sure to test for it.
‘LocalDateTime’ has ‘TimeZone’ but:
- is documented as timezone-agnostic
- why do DateTime::fromLocalDateTime take both a TimeZone and a LocalDateTime?
DateTime::now($tz) given as an example, but not documented in class interfaces
>  Long term my hope is that Hack might implement C#-like value types to allow for class-like semantics. We should design this API to be amenable to being codemoded to a class representation
This note is from 2018; enum classes have been added since then. We should evaluate if they can be used to ergonomically address this concern
> • How do we localize? Let's talk to someone from I18N to figure out if it's possible to format dates in different locales.
ICU.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment