|
@@ -1,6 +1,23 @@
|
|
|
defmodule CvGenView.Date do
|
|
defmodule CvGenView.Date do
|
|
|
use Phoenix.Component
|
|
use Phoenix.Component
|
|
|
|
|
|
|
|
|
|
+ attr(:start_date, :string, required: true)
|
|
|
|
|
+ attr(:end_date, :string, default: nil)
|
|
|
|
|
+
|
|
|
|
|
+ def time_span(assigns) when assigns.start_date == assigns.end_date,
|
|
|
|
|
+ do: ~H"""
|
|
|
|
|
+ <div class="period">
|
|
|
|
|
+ <.date date={@start_date} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
|
|
+ def time_span(assigns),
|
|
|
|
|
+ do: ~H"""
|
|
|
|
|
+ <div class="period">
|
|
|
|
|
+ <.date date={@start_date} /> - <.date date={@end_date} />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ """
|
|
|
|
|
+
|
|
|
attr(:date, :any)
|
|
attr(:date, :any)
|
|
|
attr(:rest, :global)
|
|
attr(:rest, :global)
|
|
|
|
|
|