Skip to content

Commit 3c689b6

Browse files
committed
add html title attribute to dates
1 parent edefbbd commit 3c689b6

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/Project.elm

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,27 +502,43 @@ projectTitle raw =
502502
projectYear : Year -> Html msg
503503
projectYear year =
504504
let
505-
displayRange : Date -> Date -> String
505+
displayRange : Date -> Date -> List (Html msg)
506506
displayRange start end =
507507
if Date.year start == Date.year end then
508-
String.fromInt (Date.year start)
508+
[ Html.span
509+
[ Html.Styled.Attributes.title (Date.format "EEEE, MMMM d y" start ++ " - " ++ Date.format "EEEE, MMMM d y" end) ]
510+
[ Html.text <| String.fromInt (Date.year start) ]
511+
]
509512

510513
else
511-
String.fromInt (Date.year start) ++ " - " ++ String.fromInt (Date.year end)
514+
[ Html.span
515+
[ Html.Styled.Attributes.title <| Date.format "EEEE, MMMM d y" start ]
516+
[ Html.text <| String.fromInt (Date.year start) ]
517+
, Html.text " - "
518+
, Html.span
519+
[ Html.Styled.Attributes.title <| Date.format "EEEE, MMMM d y" end ]
520+
[ Html.text <| String.fromInt (Date.year end) ]
521+
]
512522

513-
dateString =
523+
dateHtml =
514524
case year of
515525
Manual y ->
516-
String.fromInt y
526+
[ Html.text (String.fromInt y) ]
517527

518528
Range start end ->
519529
displayRange start end
520530
in
521531
Html.p
522532
[ css
523533
[ fontSize (em 0.75) ]
534+
, case year of
535+
Manual _ ->
536+
Html.Styled.Attributes.attribute "data-datetype" "manual"
537+
538+
Range _ _ ->
539+
Html.Styled.Attributes.attribute "data-datetype" "range"
524540
]
525-
[ Html.text dateString ]
541+
dateHtml
526542

527543

528544

0 commit comments

Comments
 (0)