SigmaKit.Components.Formatters (sigma_kit v0.0.16)

Summary

Functions

Displays a DateTime in the users local timezone by leveraging client side timezone convertion

Functions

local_time(assigns)

Displays a DateTime in the users local timezone by leveraging client side timezone convertion

Usage:

now = DateTime.utc_now()
in_one_month = DateTime.add(now, 40, :day)

<.local_time for={now} />
=> Apr 3, 2023, 10:17 AM

<.local_time for={now} preset="DATETIME_FULL" />
=> April 3, 2023 at 10:17 AM GMT+10

<.local_time for={now} locale="fr" />
=> 3 avr. 2023, 10:17

<.local_time for={now} format="yyyy mm dd" />
=> 2023 16 03

<.local_time for={in_one_month} format="relative" />
=> in 1 month

Preset options:

DATE_SHORT => 10/14/1983
DATE_MED => Oct 14, 1983
DATE_MED_WITH_WEEKDAY => Fri, Oct 14, 1983
DATE_FULL => October 14, 1983
DATE_HUGE => Friday, October 14, 1983
TIME_SIMPLE => 1:30 PM
TIME_WITH_SECONDS => 1:30:23 PM
TIME_WITH_SHORT_OFFSET => 1:30:23 PM EDT
TIME_WITH_LONG_OFFSET => 1:30:23 PM Eastern Daylight Time
TIME_24_SIMPLE => 13:30
TIME_24_WITH_SECONDS => 13:30:23
TIME_24_WITH_SHORT_OFFSET => 13:30:23 EDT
TIME_24_WITH_LONG_OFFSET => 13:30:23 Eastern Daylight Time
DATETIME_SHORT => 10/14/1983, 1:30 PM
DATETIME_MED => Oct 14, 1983, 1:30 PM
DATETIME_FULL => October 14, 1983 at 1:30 PM EDT
DATETIME_HUGE => Friday, October 14, 1983 at 1:30 PM Eastern Daylight Time
DATETIME_SHORT_WITH_SECONDS => 10/14/1983, 1:30:23 PM
DATETIME_MED_WITH_SECONDS => Oct 14, 1983, 1:30:23 PM
DATETIME_FULL_WITH_SECONDS => October 14, 1983 at 1:30:23 PM EDT
DATETIME_HUGE_WITH_SECONDS => Friday, October 14, 1983 at 1:30:23 PM Eastern Daylight Time

Attributes