pub trait ProvideDatetime: Send + Sync {
// Required methods
fn provide_today(&self, offset: Option<i64>) -> Option<Datetime>;
fn reset_today(&self);
}Expand description
A trait for providing access to date.
Required Methods§
Sourcefn provide_today(&self, offset: Option<i64>) -> Option<Datetime>
fn provide_today(&self, offset: Option<i64>) -> Option<Datetime>
Provides the current date.
If no offset is specified, the local date should be chosen. Otherwise, the UTC date should be chosen with the corresponding offset in hours.
If this function returns None, Typst’s datetime function will
return an error.
Note that most implementations should provide a date only or only very course time increments to ensure Typst’s incremental compilation cache is not disrupted too much.
Sourcefn reset_today(&self)
fn reset_today(&self)
Reset the current date for the next compilation.
Note that this is only relevant for those providers which actually provide the current date.