Skip to content

time datetype #282

Open
Open

Description

@dennydanek

$row[$key] = new \DateInterval("PT$m[2]H$m[3]M$m[4]S");

create new \DateInterval by force can be unwanted.
In case the key is primary - script ends with an exception, because \DateInterval doesn't have an __toString() method.

From my perspective would be better to store as string and add a new helper function for creating \DateInterval from string in Nette/utils.

Or much complicated way can be create new Class Nette\Utils\DateInterval exteded of \DateInterval which contain __toString() method - but there is a lots of options formating

Thanks for advice

Activity

  1. dg commented on Jan 19, 2022

    @dg
    Member

    I added the option to configure row normalizer to disable conversion of intervals:

    $db = new Nette\Database\Connection(...);
    $db->setRowNormalizer((new Nette\Database\RowNormalizer)->skipInterval());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions