Skip to main content

Module expires

Module expires 

Source
Expand description

Expiration time helpers.

Convenience functions for generating ISO 8601 expiration timestamps, matching the Expires module in the TypeScript SDK.

§Examples

use mpp::expires;

let five_min = expires::minutes(5);
let one_hour = expires::hours(1);
let one_week = expires::weeks(1);

Functions§

assert
Assert that an expiration timestamp is present, well-formed, and not in the past.
days
Returns an ISO 8601 datetime string n days from now.
hours
Returns an ISO 8601 datetime string n hours from now.
minutes
Returns an ISO 8601 datetime string n minutes from now.
months
Returns an ISO 8601 datetime string n months (30 days each) from now.
seconds
Returns an ISO 8601 datetime string n seconds from now.
weeks
Returns an ISO 8601 datetime string n weeks from now.
years
Returns an ISO 8601 datetime string n years (365 days each) from now.