(now time.Time, createdAt time.Time)
| 655 | } |
| 656 | |
| 657 | func preciseAgo(now time.Time, createdAt time.Time) string { |
| 658 | ago := now.Sub(createdAt) |
| 659 | |
| 660 | if ago < 30*24*time.Hour { |
| 661 | s := ago.Truncate(time.Second).String() |
| 662 | return fmt.Sprintf("%s ago", s) |
| 663 | } |
| 664 | |
| 665 | return createdAt.Format("Jan _2, 2006") |
| 666 | } |