mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 04:27:59 +01:00
fix error in search parser when using 0 for day/month, fix link to search syntax page on search form
This commit is contained in:
parent
7000be9865
commit
fb33238f72
2 changed files with 11 additions and 4 deletions
|
@ -37,7 +37,7 @@ h1 Search
|
||||||
a data-search-add="my:watched" data-search-show-help=" " My watched tags
|
a data-search-add="my:watched" data-search-show-help=" " My watched tags
|
||||||
.flex__right
|
.flex__right
|
||||||
a href="#" data-click-toggle="#js-search-tags" Quick tags
|
a href="#" data-click-toggle="#js-search-tags" Quick tags
|
||||||
a href="/search/syntax" Help
|
a href="/pages/search_syntax" Help
|
||||||
|
|
||||||
.block__content
|
.block__content
|
||||||
.hidden.walloftext data-search-help="numeric"
|
.hidden.walloftext data-search-help="numeric"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
defmodule Search.DateParser do
|
defmodule Search.DateParser do
|
||||||
import NimbleParsec
|
import NimbleParsec
|
||||||
|
|
||||||
|
defp to_int(input), do: Search.Helpers.to_int(input)
|
||||||
|
|
||||||
defp build_datetime(naive, tz_off, tz_hour, tz_minute) do
|
defp build_datetime(naive, tz_off, tz_hour, tz_minute) do
|
||||||
tz_hour =
|
tz_hour =
|
||||||
tz_hour
|
tz_hour
|
||||||
|
@ -103,9 +105,14 @@ defmodule Search.DateParser do
|
||||||
choice([string(" "), string("\t"), string("\n"), string("\r"), string("\v"), string("\f")])
|
choice([string(" "), string("\t"), string("\n"), string("\r"), string("\v"), string("\f")])
|
||||||
|> ignore()
|
|> ignore()
|
||||||
|
|
||||||
|
pos_2dig_int =
|
||||||
|
ascii_char('123456789')
|
||||||
|
|> ascii_char('0123456789')
|
||||||
|
|> reduce(:to_int)
|
||||||
|
|
||||||
year = integer(4)
|
year = integer(4)
|
||||||
month = integer(2)
|
month = pos_2dig_int
|
||||||
day = integer(2)
|
day = pos_2dig_int
|
||||||
|
|
||||||
hour = integer(2)
|
hour = integer(2)
|
||||||
minute = integer(2)
|
minute = integer(2)
|
||||||
|
|
Loading…
Reference in a new issue