Skip to content

Commit

Permalink
Show text input with today's date as the initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
kuroda committed Mar 14, 2024
1 parent 48e77a8 commit 159a710
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/daimon_date_picker_web/live/home_live.ex
Expand Up @@ -2,6 +2,10 @@ defmodule DaimonDatePickerWeb.HomeLive do
use Phoenix.LiveView

def mount(_params, _session, socket) do
socket =
socket
|> assign(:selected_date, Date.utc_today())

{:ok, socket, layout: {DaimonDatePickerWeb.Layouts, :app}}
end
end
9 changes: 8 additions & 1 deletion lib/daimon_date_picker_web/live/home_live.html.heex
@@ -1 +1,8 @@
<div>home_live.html.heex</div>
<div>
<input
type="text"
class="w-60"
value={Date.to_string(@selected_date)}
readonly
/>
</div>

0 comments on commit 159a710

Please sign in to comment.