mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 10:28:27 +00:00
Allow to search for *
in custom date fields
This requires to pass the raw input through to the caller. Closes: #550
This commit is contained in:
@ -266,6 +266,13 @@ update1 forSearch msg model =
|
||||
DatePicker.None ->
|
||||
( old, NoResult )
|
||||
|
||||
DatePicker.FailedInput (DatePicker.Invalid str) ->
|
||||
if forSearch && hasWildCards str then
|
||||
( Nothing, Value str )
|
||||
|
||||
else
|
||||
( old, NoResult )
|
||||
|
||||
DatePicker.FailedInput _ ->
|
||||
( old, NoResult )
|
||||
|
||||
@ -289,11 +296,7 @@ updateFloatModel :
|
||||
-> (String -> String)
|
||||
-> ( FloatModel, FieldResult )
|
||||
updateFloatModel forSearch msg parse normalize =
|
||||
let
|
||||
hasWildCards =
|
||||
String.startsWith "*" msg || String.endsWith "*" msg
|
||||
in
|
||||
if forSearch && hasWildCards then
|
||||
if forSearch && hasWildCards msg then
|
||||
( { input = normalize msg
|
||||
, result = Ok 0
|
||||
}
|
||||
@ -317,6 +320,11 @@ updateFloatModel forSearch msg parse normalize =
|
||||
)
|
||||
|
||||
|
||||
hasWildCards : String -> Bool
|
||||
hasWildCards msg =
|
||||
String.startsWith "*" msg || String.endsWith "*" msg
|
||||
|
||||
|
||||
|
||||
--- View
|
||||
|
||||
|
Reference in New Issue
Block a user