Skip to main content

DateValue

Trait DateValue 

Source
pub trait DateValue:
    Sized
    + Send
    + Sync
    + 'static {
    // Required method
    fn calendar_date(&self, zone: &TimeZone) -> Option<Date>;

    // Provided methods
    fn stored_text(&self) -> String { ... }
    fn format_in(&self, cx: &Cx) -> String { ... }
}
Expand description

The field types a DateColumn spells as a calendar day: jiff::civil::Date, jiff::civil::DateTime, jiff::Timestamp (read in the request’s time_zone, as a DateFilter reads it) and an Option of any of them.

Required Methods§

Source

fn calendar_date(&self, zone: &TimeZone) -> Option<Date>

The value’s calendar day in zone, None when it holds none. A civil value names its day whatever the zone.

Provided Methods§

Source

fn stored_text(&self) -> String

The value’s stored spelling, which a column’s text and export carry. The default spells the calendar day in UTC as an ISO date.

Source

fn format_in(&self, cx: &Cx) -> String

The value’s calendar day as a DateColumn cell spells it: in the request’s locale, Oct 14, 2026 in English, and a timestamp’s in the request’s time_zone. Empty when it holds none. For a page, a widget or a mail that shows a date in the reader’s words rather than as ISO text in UTC.

use tablo_core::DateValue;
let renews: jiff::Timestamp = "2026-10-14T09:30:00Z".parse().unwrap();
let line = renews.format_in(cx); // "Oct 14, 2026", "14 oct. 2026" in French

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl DateValue for Date

Source§

fn calendar_date(&self, _zone: &TimeZone) -> Option<Date>

Source§

fn stored_text(&self) -> String

Source§

impl DateValue for DateTime

Source§

fn calendar_date(&self, _zone: &TimeZone) -> Option<Date>

Source§

fn stored_text(&self) -> String

Source§

impl DateValue for Timestamp

Source§

fn calendar_date(&self, zone: &TimeZone) -> Option<Date>

Source§

fn stored_text(&self) -> String

Source§

impl<T> DateValue for Option<T>
where T: DateValue,

Source§

fn calendar_date(&self, zone: &TimeZone) -> Option<Date>

Source§

fn stored_text(&self) -> String

Implementors§