Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Date.php preProcessIndex to use format from config #6845

Merged
merged 5 commits into from
Oct 10, 2022
Merged

Update Date.php preProcessIndex to use format from config #6845

merged 5 commits into from
Oct 10, 2022

Commits on Oct 7, 2022

  1. Update Date.php preProcessIndex to use format from config

    When a format is specified for a Date field and the field is present on the list, it always throw a DateTime::__construct(): Failed to parse time string exception. Example I have created a date field with the format: "y-m" and when I add that field to the list then this is the thrown exception:
    
    Could not parse '20-10': DateTime::__construct(): Failed to parse time string (20-10) at position 0 (2): Unexpected character {"userId":2,"exception":"[object] (Carbon\\Exceptions\\InvalidFormatException(code: 0): Could not parse '20-10': DateTime::__construct(): Failed to parse time string (20-10) at position 0 (2): Unexpected character at /var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:190) [stacktrace]
    #0 /var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php(216): Carbon\\Carbon::rawParse('20-10', NULL)
    #1 /var/www/html/vendor/statamic/cms/src/Fieldtypes/Date.php(300): Carbon\\Carbon::parse('20-10')
    #2 /var/www/html/vendor/statamic/cms/src/Fieldtypes/Date.php(126): Statamic\\Fieldtypes\\Date->parseSaved('20-10')
    #3 /var/www/html/vendor/statamic/cms/src/Fieldtypes/Date.php(110): Statamic\\Fieldtypes\\Date->preProcessSingle('20-10')
    #4 /var/www/html/vendor/statamic/cms/src/Fields/Field.php(314): Statamic\\Fieldtypes\\Date->preProcess('20-10')
    #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php(60): Statamic\\Fields\\Field->preProcess()
    #6 [internal function]: Illuminate\\Support\\HigherOrderCollectionProxy->Illuminate\\Support\\{closure}(Object(Statamic\\Fields\\Field), 'date
    granitibrahimi authored Oct 7, 2022
    Configuration menu
    Copy the full SHA
    0ab5cb0 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    aed3b56 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    43f0f9b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0337645 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2022

  1. use existing method

    jasonvarga committed Oct 10, 2022
    Configuration menu
    Copy the full SHA
    efc5ad3 View commit details
    Browse the repository at this point in the history