mendraw/mendix/date

Converts between Mendix date values and JavaScript dates.

Types

A typed JsDate value used by the date capability.

pub type JsDate

Values

pub fn create(
  year year: Int,
  month month: Int,
  day day: Int,
  hours hours: Int,
  minutes minutes: Int,
  seconds seconds: Int,
  milliseconds milliseconds: Int,
) -> JsDate

Creates a date from calendar and clock components.

pub fn day(date date: JsDate) -> Int

Returns the local day of the month.

pub fn day_of_week(date date: JsDate) -> Int

Returns the local day-of-week index.

pub fn from_input_value(
  date_string date_string: String,
) -> option.Option(JsDate)

Parses a date from an HTML input value.

pub fn from_iso(iso_string iso_string: String) -> JsDate

Parses an ISO-8601 date string.

pub fn from_timestamp(ms ms: Int) -> JsDate

Creates a date from a Unix timestamp.

pub fn hours(date date: JsDate) -> Int

Returns the local hour.

pub fn milliseconds(date date: JsDate) -> Int

Returns the local millisecond.

pub fn minutes(date date: JsDate) -> Int

Returns the local minute.

pub fn month(date date: JsDate) -> Int

Returns the local calendar month.

pub fn now() -> JsDate

Returns the current JavaScript date.

pub fn seconds(date date: JsDate) -> Int

Returns the local second.

pub fn to_input_value(date date: JsDate) -> String

Formats a date for an HTML date or time input.

pub fn to_iso(date date: JsDate) -> String

Serializes a date as ISO-8601 text.

pub fn to_string(date date: JsDate) -> String

Returns the JavaScript string representation of a date.

pub fn to_timestamp(date date: JsDate) -> Int

Returns the Unix timestamp for a date.

pub fn year(date date: JsDate) -> Int

Returns the local calendar year.

Search Document