Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/Feliz.Bulma.DateTimePicker/DateTime.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module DatePicker =
abstract maxDate: DateTime option
abstract dateOnly : bool
abstract allowTextInput : bool
abstract showClearButton : bool
abstract closeOnSelect: bool

type private DateTimeValue = { Date : DateTime option; Time : TimeSpan option }
Expand Down Expand Up @@ -464,14 +465,15 @@ module DatePicker =
]
]
]
Html.divClassed "datetimepicker-footer" [
Html.button [
prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ]
prop.type' "button"
prop.text p.clearLabel
prop.onClick onClear
if p.showClearButton then
Html.divClassed "datetimepicker-footer" [
Html.button [
prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ]
prop.type' "button"
prop.text p.clearLabel
prop.onClick onClear
]
]
]
]
let format (d:DateTime) =
let formatString =
Expand Down Expand Up @@ -616,3 +618,4 @@ type dateTimePicker =
/// Close the picker when the date is selected, only applicable for DatePicker
static member inline closeOnSelect (v:bool) : IDateTimePickerProperty = unbox ("closeOnSelect", v)
static member inline allowTextInput (v:bool) : IDateTimePickerProperty = unbox ("allowTextInput", v)
static member inline showClearButton (v:bool) : IDateTimePickerProperty = unbox ("showClearButton", v)
17 changes: 10 additions & 7 deletions src/Feliz.Bulma.DateTimePicker/Time.fs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module TimePicker =
abstract isRange : bool
abstract displayMode : DisplayMode
abstract clearLabel : string
abstract showClearButton : bool

let private safeHours (hrs:int) =
if hrs < 0 then 23
Expand Down Expand Up @@ -133,14 +134,15 @@ module TimePicker =
]
]
]
Html.divClassed "datetimepicker-footer" [
Html.button [
prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ]
prop.type' "button"
prop.text p.clearLabel
prop.onClick (fun _ -> None |> updateTime)
if p.showClearButton then
Html.divClassed "datetimepicker-footer" [
Html.button [
prop.classes [ "datetimepicker-footer-clear"; "has-text-danger"; "button"; "is-small"; "is-text" ]
prop.type' "button"
prop.text p.clearLabel
prop.onClick (fun _ -> None |> updateTime)
]
]
]
]
let txtValue =
if p.isRange then time |> Option.map (fun (s,t) -> sprintf "%s - %s" (toFormattedTime s) (toFormattedTime t))
Expand Down Expand Up @@ -186,3 +188,4 @@ type timePicker =
static member inline isRange (v:bool) : ITimePickerProperty = unbox ("isRange", v)
static member inline displayMode (v:DisplayMode) : ITimePickerProperty = unbox ("displayMode", v)
static member inline clearLabel (v:string) : ITimePickerProperty = unbox ("clearLabel", v)
static member inline showClearButton (v:bool) : ITimePickerProperty = unbox ("showClearButton", v)