Skip to content

[5.x]: formatDateWithoutIntl(): Argument #1 ($value) must be of type DateTime #3998

@turnstylerj

Description

@turnstylerj

What happened?

Description

Unsure if this is related to an issue I ran into with the Stripe gateway here, but when creating a new subscription plan, I'm getting the following error on save:

2025-05-02 12:12:11 [web.ERROR] [TypeError] TypeError: craft\i18n\Formatter::formatDateWithoutIntl(): Argument #1 ($value) must be of type DateTime|string|int, null given, called in /var/www/html/vendor/craftcms/cms/src/i18n/Formatter.php on line 88 and defined in /var/www/html/vendor/craftcms/cms/src/i18n/Formatter.php:109
Stack trace:
#0 /var/www/html/vendor/craftcms/cms/src/i18n/Formatter.php(88): craft\i18n\Formatter->formatDateWithoutIntl(NULL, 'M/d/yyyy')
#1 /var/www/html/vendor/craftcms/commerce/src/controllers/PlansController.php(125): craft\i18n\Formatter->asDate(NULL, 'M/d/yyyy')
#2 [internal function]: craft\commerce\controllers\PlansController->actionEditPlan(NULL, Object(craft\commerce\stripe\models\Plan))
#3 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#4 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#5 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('edit-plan', Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(361): yii\base\Module->runAction('commerce/plans/...', Array)
#7 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('commerce/plans/...', Array)
#8 /var/www/html/vendor/craftcms/cms/src/web/Application.php(329): yii\web\Application->handleRequest(Object(craft\web\Request))
#9 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#10 /var/www/html/web/index.php(12): yii\base\Application->run()
#11 {main} {"memory":6961464,"exception":"[object] (TypeError(code: 0): craft\\i18n\\Formatter::formatDateWithoutIntl(): Argument #1 ($value) must be of type DateTime|string|int, null given, called in /var/www/html/vendor/craftcms/cms/src/i18n/Formatter.php on line 88 at /var/www/html/vendor/craftcms/cms/src/i18n/Formatter.php:109)"} 

The plan seems to be created successfully if I navigate back to the Subscription Plans page.

Steps to reproduce

  1. Create a new subscription plan using the Stripe gateway

Expected behavior

Plan is created

Actual behavior

Plan is created, but page errors out

Craft CMS version

5.6.17

Craft Commerce version

5.3.11

PHP version

8.2.28

Operating system and version

Linux 6.8.0-57-generic

Database type and version

MySQL 8.0.40

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

CKEditor 4.4.0
Colour Swatches 5.1.0
Control Panel CSS 3.0.0
Cookies 5.0.0
Craft Commerce 5.3.11
Default Dashboard 3.0.1
Element Relations 3.0.6
Field Manager 4.0.3
GeoMate 3.0.0
Guide 5.2.0
ImageOptimize 5.0.4
Image Resizer 4.0.1
LJ Dynamic Fields 5.0.1
Multi Translator 2.10.3
Neo 5.2.21
No-Cache 3.0.4
PayPal Checkout for Craft Commerce 3.0.3
Redirects 5.0.5
Retcon 3.2.1
SEO 5.1.9
Servd Assets and Helpers 4.0.12
Stripe for Craft Commerce 5.0.7

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions