Skip to content

Commit

Permalink
Update PosixDate.format doc string (#4450)
Browse files Browse the repository at this point in the history
Note the "not at all obvious" caveat where we normalize %p and %P
handling. Some locales will return an empty string for those format
strings which if they are the only thing in the format string makes
it impossible to know if there was success or failure from the format
so we short-circuit those and make all locales return empty string
if either formatting option is the only one in the format string.
  • Loading branch information
SeanTAllen authored Sep 19, 2023
1 parent 7c223c3 commit 3bfa129
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/time/posix_date.pony
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class PosixDate
fun format(fmt: String): String ? =>
"""
Format the time as for strftime.
Will return an empty string if the format string is "%p" or "%P".
"""
recover
String.from_cstring(@ponyint_formattime(this, fmt.cstring())?)
Expand Down

0 comments on commit 3bfa129

Please sign in to comment.