All posts tagged with 'active support'

Readable Dates in Rails
I was playing around in Swift recently, and wanted a reference to 'one day ago'. This is simple enough in human terms: if it's 9:30 on the 18th of September, 'one day ago' means 9:30 on the 17th of September. The Swift code to do this looks like this: Calendar.current.date( byAdding: .day, value: -1, to: Date.now ) ...and that's just a bit much, isn't it? First we need to access Calendar.current, a singleton… Continue reading