File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,21 @@ defmodule ComponentsGuideWeb.CalendarComponent do
2
2
use ComponentsGuideWeb , :component
3
3
4
4
def calendar_grid ( assigns ) do
5
- % { year: year , month: month , day: day } = today = assigns [ :date ]
6
- start_date = Date . beginning_of_month ( today )
7
- end_date = Date . end_of_month ( today )
5
+ % { year: year , month: month } = assigns
6
+
7
+ day =
8
+ case assigns [ :current_date ] do
9
+ nil ->
10
+ nil
11
+
12
+ % { day: day } ->
13
+ day
14
+ end
15
+
16
+ # %{year: year, month: month, day: day} = today = assigns[:date]
17
+ date = Date . new! ( year , month , 1 )
18
+ start_date = Date . beginning_of_month ( date )
19
+ end_date = Date . end_of_month ( date )
8
20
date_range = Date . range ( start_date , end_date )
9
21
10
22
day_inset = Date . day_of_week ( start_date )
Original file line number Diff line number Diff line change 1
1
< div class = "prose md:prose-xl prose-invert max-w-6xl mx-auto pt-8 px-3 " >
2
2
< h1 class = "text-center " > Developer Calendar</ h1 >
3
- < CalendarComponent . calendar_grid date = { @ today } extra = { @ calendar_extra } />
3
+ < CalendarComponent . calendar_grid year = { @ today . year } month = { @ today . month } current_date = { @ today } extra = { @ calendar_extra } />
4
4
</ div >
5
5
6
6
< div class = "prose md:prose-xl prose-invert max-w-2xl mx-auto pt-8 pb-16 px-3 " >
You can’t perform that action at this time.
0 commit comments