TYPO3-Solr / ext-solr

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
136 stars 246 forks source link

[BUG] DateRange Facet Datepicker doesn't display in other languages #2708

Open linawolf opened 4 years ago

linawolf commented 4 years ago

Describe the bug The Daterange datepicker is always displayed in English.

Importing the language package for the datepicker i.e.

page.includeJSFooterlibs {
    solr-ui-de = EXT:solr/Resources/Public/JavaScript/JQuery/ui-i18n/jquery.ui.datepicker-de.js
}

makes no difference

To Reproduce TYPO3 8.7.36 eLTS Extension solr 8.1.2

DataRange Facet with Standard Template, Typoscript:

plugin.tx_solr.search {
    #[....]

    faceting = 1
    faceting {
        facets = 1
        facets {
            allDatesRange {
                label = Zeitraum
                field = allDates_dateM

                type = dateRange

                dateRange {
                    start = NOW/DAY-1YEAR
                    end = NOW/DAY+1YEAR
                    gap = +1DAY
                }
            }
        }
    }
}

# Load js files
page.includeJSFooterlibs {
    solr-jquery = EXT:solr/Resources/Public/JavaScript/JQuery/jquery.min.js
    solr-ui = EXT:solr/Resources/Public/JavaScript/JQuery/jquery-ui.min.js
    solr-daterange = EXT:solr/Resources/Public/JavaScript/facet_daterange_controller.js
    solr-options = EXT:solr/Resources/Public/JavaScript/facet_options_controller.js
    solr-ui-de = EXT:solr/Resources/Public/JavaScript/JQuery/ui-i18n/jquery.ui.datepicker-de.js
}

page.includeCSS {
    solr-ui = EXT:solr/Resources/Css/JQueryUi/jquery-ui.custom.css
}

Expected behavior Month and Day should be in German

Used versions (please complete the following information):

Additional context We have the same problem on several instances the only solution so far was to exchange the DateRange Picker for one Based on Bootstraps bootstrap-datepicker.min.js with our own Template. The error can be reproduced in ddev and on production server.

dkd-kaehm commented 4 years ago

Hello @linawolf, thanks for reporting. Isn't the jQuery Date Picker today not obsolete? What about browsers native date picker with some up-to-tode fallback js lib?

linawolf commented 4 years ago

I think it would be a good idea to ship a browsers native solution as working example. Such solutions are not trivial to implement.

web/typo3conf/ext/solr/Classes/Domain/Search/ResultSet/Facets/RangeBased/DateRange/DateRange.php

 protected function getRangeString()
    {
        return $this->startRequested->format('Ymd') . '0000-' . $this->endRequested->format('Ymd') . '0000';
    }

Throws error if start or enddate is not set. So we hat to do some JS tweaks to never send an empty date.