Proposal: strftime-based calendar/datetime formatting

I think that an important part of formatting is to return good errors when the input data is not available for formatting. For instance if you call Calendar.format(nil, “%Y-%m-%d %H:%M:%S.%f”) it should return an error. Because nil does not have a year, nor hour nor minute and so on.

Likewise if you have a simple Date such as ~D[2018-12-15] and then call format with “%H:%M” (hour and minute) an error should be returned. Just like nil does not have any hour or minute, neither does ~D[2018-12-15].

1 Like