RelativeTimeTag
struct RelativeTimeTag : LeafTag
Turns a Date string into a relative date string. Argument is a ISO8601 formatted Date, or what JSON encoding does to Date values. Output is a string giving a relative time in the past (from now) indicating the approximate time of the Date.
Output is constrained to a single element. e.g: “3 hours ago”, “1 day ago”, “5 minutes ago”
Usage in Leaf templates: #relativeTime(dateValue) -> String
-
Declaration
Swift
func render(_ ctx: LeafContext) throws -> LeafData