Function filter_date

Source
pub fn filter_date(
    value: &Value,
    args: &HashMap<String, Value>,
) -> Result<Value>
Expand description

This is a partial reimplementation of Tera’s date filter that handles empty dates strings.

Some date fields in the source data might be blank. Instead of throwing a ‘type’ error (Teras default behaviuor), this function returns a blank string if an empty date is passed to the date filter.

Additionally, this only handles DateTime’s default serialize format: RFC 3339. As we’re using DateTimes default Serialize implementation, we can use its default [FromStr] to deserialize it.