top-think / top-think/think-orm

模型字段类型datetime自动转码问题

Open
#117 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Description

https://github.com/top-think/think-orm/blob/b6f61fc243974a25cb6914b84a529b373a717626/src/model/concern/Attribute.php#L427

$this->formatDateTime('Y-m-d H:i:s.u', $value);中第二个参数$value已经是timestamp了,是否要加第三个参数为true,否则执行到formatDateTime里的$dateTime = new DateTime($time);时报错

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/model/concern/Attribute.php around line 427 and trace the call to formatDateTime, especially how the timestamp value reaches DateTime($time). Reproduce the datetime model-field case and verify that timestamp input is handled without an exception; add or update regression coverage if the repository provides a relevant test location.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.