Search results

There are no results.

wobsite.time.human_readable_date

Show source code
Hide source code
fn pub human_readable_date(date: ref DateTime) -> String {
  '${MONTHS.get(date.month - 1)} ${date.day}, ${date.year}'
}
fn pub static human_readable_date(date: ref DateTime) -> String

Formats a DateTime in a human readable format.

Examples

import std.time (DateTime)
import wobsite.time (human_readable_date)

let date = DateTime(
  year: 2024,
  month: 1,
  day: 2,
  hour: 13,
  minute: 14,
  second: 15,
  sub_second: 0.0,
  utc_offset: 0,
)

human_readable_date(date) # => 'January 2, 2024'