searchbuilder datetime

searchbuilder datetime

kringelkringel Posts: 16Questions: 9Answers: 0

Hello!

Here is my problem:

Not sorted table looks like this

When I try to sort by day, I want it to show all the results for today, but it shows nothing

When I enter the full date and time, it shows one result as expected.

How can I make it show all rows for selected day? Thanks in advance!

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • kringelkringel Posts: 16Questions: 9Answers: 0

    Hey, found a solution to my problem

    Changed this

            Field::inst( 'logged_in_at' )
                ->set( false )
                ->validator( Validate::dateFormat( 'Y-m-d H:i:s' ) )
                ->getFormatter( Format::datetime( 'Y-m-d H:i:s', 'Y-m-d H:i:s' ) )
                ->setFormatter( Format::datetime( 'Y-m-d H:i:s', 'Y-m-d H:i:s' ) )
        )
    

    to this and search works fine

            Field::inst( 'logged_in_at' )
                ->set( false )
                ->validator( Validate::dateFormat( 'Y-m-d H:i:s' ) )
                ->getFormatter( Format::datetime( 'Y-m-d H:i:s', 'Y-m-d' ) )
                ->setFormatter( Format::datetime( 'Y-m-d H:i:s', 'Y-m-d' ) )
        )
    
This discussion has been closed.