(now time.Time, createdAt time.Time)
| 685 | } |
| 686 | |
| 687 | func preciseAgo(now time.Time, createdAt time.Time) string { |
| 688 | ago := now.Sub(createdAt) |
| 689 | |
| 690 | if ago < 30*24*time.Hour { |
| 691 | s := ago.Truncate(time.Second).String() |
| 692 | return fmt.Sprintf("%s ago", s) |
| 693 | } |
| 694 | |
| 695 | return createdAt.Format("Jan _2, 2006") |
| 696 | } |