MbtaMetro.Live.DatePicker (MbtaMetro v0.2.0)

View Source

A live component that renders a date picker using Flatpickr.

You must pass in the following assigns:

  • :field - A form field struct retrieved from a form, for example: @form[:datetime].

You can optionally pass in a :config map:

  • :default_date - The default date that should be selected.
  • :enable_time - A boolean that determines if the time picker should be enabled.
  • :max_date - The maximum date that can be selected.
  • :min_date - The minimum date that can be selected.

Summary

Functions

When we get an event to set the dateime, we push the event to the socket. This will be picked up by the Hook.

Renders the date picker component.

Functions

handle_event(binary, map, socket)

When we get an event to set the dateime, we push the event to the socket. This will be picked up by the Hook.

mount(params, session, socket)

render(assigns)

Renders the date picker component.