4 ms·
This confused me with Foundation's Date class as well. I think it's really important to have abstractions that are really clear. Like for example I had to repre
by pducks32 9y ago
This confused me with Foundation's Date class as well. I think it's really important to have abstractions that are really clear. Like for example I had to represent Open Hours for business and wanted a way to represent 4pm on Monday. That's surprisingly hard (in Swift and Java) because the APIs want you to realize the complexity of Time. But I don't care. I want an abstraction that says "Yup it's Monday at 4pm in Santa Clara". I think better Date and Time libraries that deal with more user facing things would be great.
- saagarjha 9y ago`NSDate` used to support creation from a "natural language" phrase: https://developer.apple.com/reference/foundation/nsdate/1415776-date https://developer.apple.com/reference/foundation/nsdate/1415... It was deprecated recently, however.
- chc 9y agoEven further back, there was an NSCalendarDate class that was supposed to represent the human concept of a date. IIRC they got rid of it because they felt like it muddled presentational concerns with data structure concerns. It was pretty convenient, though.
- saagarjha 9y agoYep, I had to do a bit of fuddling around with DateComponents and it was painful.
- mabbo 9y ago> That's surprisingly hard (in Swift and Java) because the APIs want you to realize the complexity of Time That's because time is hard. Time feels easy because we use it constantly in every day tasks. And if you just ignore those complexities, you get buggy code that costs your company money.
- jdmichal 9y agoTime feels easy because we humans constantly make implicit and contextual assumptions about meaning. Computers are terrible at both implicit and contextual assumptions.