Fix scraper date parser failing when parsing time (#1431)

* Don't mutate the original scraped date

`time.Parse` is case-sensitive for some values, `AM/pm` in particular
This commit is contained in:
peolic 2021-05-26 00:29:51 +03:00 committed by GitHub
parent d6ada23616
commit cc5ec650ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -368,10 +368,10 @@ func (p *postProcessParseDate) Apply(value string, q mappedQuery) string {
const internalDateFormat = "2006-01-02"
value = strings.ToLower(value)
if value == "today" || value == "yesterday" { // handle today, yesterday
valueLower := strings.ToLower(value)
if valueLower == "today" || valueLower == "yesterday" { // handle today, yesterday
dt := time.Now()
if value == "yesterday" { // subtract 1 day from now
if valueLower == "yesterday" { // subtract 1 day from now
dt = dt.AddDate(0, 0, -1)
}
return dt.Format(internalDateFormat)

View File

@ -12,5 +12,6 @@
* Add button to remove studio stash ID. ([#1378](https://github.com/stashapp/stash/pull/1378))
### 🐛 Bug fixes
* Fix scraper date parser failing when parsing time. ([#1431](https://github.com/stashapp/stash/pull/1431))
* Fix quotes in filter labels causing UI errors. ([#1425](https://github.com/stashapp/stash/pull/1425))
* Fix post-processing not running when scraping by performer fragment. ([#1387](https://github.com/stashapp/stash/pull/1387))