studioespresso / craft-date-range

Date range field for Craft CMS
MIT License
12 stars 5 forks source link

Syntax error. #19

Closed bartrylant closed 4 years ago

bartrylant commented 4 years ago

On Craft 3.5, when trying to edit/create an entry with a date range field, and error page is shown:

Invalid Argument – yii\base\InvalidArgumentException Syntax error.

 in /Users/xxx/Sites/xxx/vendor/studioespresso/craft-date-range/src/fields/data/DateRangeData.php at line 125– yii\helpers\BaseJson::decode('2020-05-06 17:30:00')
119120121122123124125126127128129130131        return false;
    }

    public static function normalize($value = null, FieldInterface $config)
    {
        if (!is_array($value)) {
            $value = Json::decode($value);  <<<<<<<<<<<<<<<<<<<<<< ERROR
        }

        if ((isset($value['start']['date']) && !$value['start']['date'])
        ) {
            return false;
        } else {
kerns commented 4 years ago

@bartrylant Any fix for this or alternative plugin on your radar?

janhenckens commented 4 years ago

Hey folks, I'm away on holiday for a few days, sorry for the late reply. I'll try to get online tomorrow to see if I can get a quick fix out.

@bartrylant could you share the settings you have for the field in question? Thanks!

janhenckens commented 4 years ago

@bartrylant @kerns Could either of you provide a bit more information on when you are seeing this error? I've tried creating new entries with a date range field and that works without issue on my end. Any extra information would be appreciated, thanks!

janhenckens commented 4 years ago

@bartrylant @kerns Any more input on this? Ready to help you out but I can't reproduce the issue on my end. Thanks for your feedback!

bartrylant commented 4 years ago

I've deleted the field and added it again and everything works as it should now. Maybe something went wrong when performing a Craft update from 3.4 to 3.5?