otzbergnet/wbmExtension

[REQ] nice timestamps

Closed this issue · 5 comments

So instead of 25 Oct 2019, 03:03 maybe we could have 1 month ago

On pinboard website there is a good model to follow:

  • just now (within the last hour?)
  • hours ago (up to 24 hours)
  • yesterday (date is yesterday)
  • days ago (up to ~30 days)
  • weeks ago (up to 12 weeks)
  • july 2019 (over 12 weeks)

Sample code from https://github.com/kristofa/bookmarker_for_pinboard/blob/f736e03e54f2940a7e45f50e5cbbe82cd7e6cd19/bookmarker%20for%20pinboard%20extension/SafariExtensionHandler.swift#L103-L127

private func readableIntervalSinceNow(dateAsString: String) -> String {
    let formatter = ISO8601DateFormatter();
    if let date = formatter.date(from: dateAsString) {
        
        let timeInterval = date.timeIntervalSinceNow
        if (timeInterval > -3600) { // less than 1 hour
            return "just now."
        } else if (timeInterval > -86400) { // less than a day
            let hours = abs(timeInterval / 3600)
            return "\(String(format: "%.0f", hours)) hours ago."
            //String(format: "%.f", hours)
        } else if (timeInterval > (-604800 * 4)) { // less than a months
            let days = abs(timeInterval / 86400)
            return "\(String(format: "%.0f", days)) days ago."
        } else if (timeInterval > (-604800 * 4 * 3)) { // less than 3 months
            let weeks = abs(timeInterval / 604800)
            return "\(String(format: "%.0f", weeks)) weeks ago."
        } else {
            let dateFormatter = DateFormatter()
            dateFormatter.setLocalizedDateFormatFromTemplate("MMMM YYYY")
            return "\(dateFormatter.string(from: date))."
        }
    }
    return dateAsString
}

How do you envisage the display

This page was last archived: a few days ago

For my understanding: how is the abstract better than the detailed timestamp? I am not opposed to do this, I am just trying to understand how we are improving the user experience by making it less detailed...

In short, relative timestamps are better when you need to quickly see "how recently" rather than "when exactly"

https://uxmovement.com/content/absolute-vs-relative-timestamps-when-to-use-which/

I'll make it an option - because I agree with the usefulness of the relative timestamp, but I personally do care about the exact one :) Sorry, but we have so many options already, that one more, won't hurt. I'll make the relative timestamp the default

Icons from me soon and then after that IMHO we are shippable.

Thanks Matt :)