create-prisma-php-app 3.6.6 → 3.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,7 @@ use Brick\Math\Exception\MathException;
16
16
  use Brick\Math\RoundingMode;
17
17
  use InvalidArgumentException;
18
18
  use BackedEnum;
19
+ use Throwable;
19
20
 
20
21
  final class Validator
21
22
  {
@@ -255,13 +256,15 @@ final class Validator
255
256
  */
256
257
  public static function dateTime($value, string $format = 'Y-m-d H:i:s'): ?string
257
258
  {
259
+ if ($value === null || $value === '') {
260
+ return null;
261
+ }
262
+
258
263
  try {
259
- if ($value instanceof DateTime) {
260
- $date = $value;
261
- } else {
262
- $date = new DateTime($value);
263
- }
264
- } catch (Exception) {
264
+ $date = $value instanceof DateTime
265
+ ? $value
266
+ : new DateTime((string) $value);
267
+ } catch (Throwable) {
265
268
  return null;
266
269
  }
267
270
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma-php-app",
3
- "version": "3.6.6",
3
+ "version": "3.6.7",
4
4
  "description": "Prisma-PHP: A Revolutionary Library Bridging PHP with Prisma ORM",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",