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

2.2 Dev sqlsrv: date/time "2022-12-24 17:06:37.327" does not match pattern "Y-m-d H:i:s" #4682

Open
FrankWarius opened this issue Dec 24, 2022 · 5 comments

Comments

@FrankWarius
Copy link

FrankWarius commented Dec 24, 2022

date/time "2022-12-24 17:06:37.327" does not match pattern "Y-m-d H:i:s" …\app\Factories\TimestampFactory.php:68
#0 …\app\Statistics\Repository\GedcomRepository.php(169): Fisharebest\Webtrees\Factories\TimestampFactory->fromString('2022-12-24 17:0...')
#1 …\app\Statistics.php(273): Fisharebest\Webtrees\Statistics\Repository\GedcomRepository->gedcomUpdated()
#2 …\app\Statistics.php(2845): Fisharebest\Webtrees\Statistics->gedcomUpdated()
#3 …\app\Statistics.php(214): Fisharebest\Webtrees\Statistics->getTags('\r\n <p class=...')
#4 …\app\Module\FamilyTreeStatisticsModule.php(189): Fisharebest\Webtrees\Statistics->embedTags('\r\n <p class=...')
#5 …\app\Http\RequestHandlers\TreePageBlock.php(66): Fisharebest\Webtrees\Module\FamilyTreeStatisticsModule->getBlock(Object(Fisharebest\Webtrees\Tree), 23, 'tree')

doesn't work either with "Y-M-d H:m:s"

@FrankWarius FrankWarius changed the title 2.1 Dev sqlsrv: date/time "2022-12-24 17:06:37.327" does not match pattern "Y-m-d H:i:s" 2.2 Dev sqlsrv: date/time "2022-12-24 17:06:37.327" does not match pattern "Y-m-d H:i:s" Dec 24, 2022
@FrankWarius
Copy link
Author

public function fromString(?string $string, string $format = 'Y-m-d H:i:s.v', UserInterface $user = null): TimestampInterface
works for sqlsrv

@fisharebest
Copy link
Owner

The database migrations create timestamp columns with a default precision of 0.

So, I would expect the column wt_change.change_time to contain integer seconds.

But your table contains milliseconds.

Question - did you do anything to change this column, or was it created by the migration?

@FrankWarius
Copy link
Author

it is a blank out of the (2.2 dev) box installation. After that I exported my 2.1 Gedcom and imported it to 2.2 and did one source change (successful).

@FrankWarius
Copy link
Author

it is already logged by the SetupWizzard if the database is MS SQL.

log_id log_time log_type log_message ip_address user_id gedcom_id
1 2024-01-01 12:08:05.553 config Site preference "WT_SCHEMA_VERSION" set to "1" ::1 NULL NULL
2 2024-01-01 12:08:05.563 config Site preference "WT_SCHEMA_VERSION" set to "2" ::1 NULL NULL
3 2024-01-01 12:08:05.573 config Site preference "WT_SCHEMA_VERSION" set to "3" ::1 NULL NULL
...
78 2024-01-01 18:34:39.127 edit Update: INDI I1811 ::1 1 1

changing $format to 'Y-m-d H:i:s.v' in booth TimeStampFactory and TimeStampFactoryInterface fixes the error

@FrankWarius
Copy link
Author

The database migrations create timestamp columns with a default precision of 0.
Question - did you do anything to change this column, or was it created by the migration?

No,

type is datetime decimals are set to 3 by migration.

TSQL datetime always have 3 decimals see https://learn.microsoft.com/en-us/sql/t-sql/data-types/datetime-transact-sql?view=sql-server-ver16

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants