Correct time parsing in date range filter

Components

Labels

Description

  1. in "\kDateFormatter::Parse" method: 

    • 0.2h

    • add optional (defaults to "null") $format parameter

    • when $format parameter isn't specified (existing code), then take it's value from "input_format" field option

  2. in "\kSearchHelper::_getInputTimeFormat" method: 

    • 0.3h

    • add optional (defaults to "input_time_format") "$format_option_name" parameter

    • in call sites (found 1 place) specify "input_time_format" as 2nd parameter value

    • use str_replace/ucwords function combo to create "$lang_current" object field name from "$format_option_name" parameter value

  3. in "\kSearchHelper::processRangeField" method: 

    • 1h

    • add optional (default to "") $format_option_prefix parameter

    • when time is missing, then always add time for "00:00:00" instead of dynamically getting time based on field type

    • when calling "\kSearchHelper::_getInputTimeFormat" method instead of "input_time_format" specify $format_option_prefix . 'time_format'

    • before calling "$formatter->Parse":

      • set "$format" variable (new) to the $options[$format_option_prefix . 'format'] value

      • specify $format variable as $format argument of "\kDateFormatter::Parse" method call

    • if there was an error during date parsing and $format_option_prefix parameter is empty, then instead of returning "false" return result of calling "\kSearchHelper::processRangeField" method with same parameters, except that $format_option_prefix argument would be set to "input_"

  4. in "\kSearchHelper::getCustomFilterSearchClause" method, when handling "date_range" filter type: 

    • 0.5h

    • do the from/to guessing when either of them is specified ONLY, when time is absent in specified date

    • when $to is specified, but missing a time, then add 23:59:59 time to it

    • if only $from/$to is specified and it has time in it, then instead of date range filter to exact match ignoring seconds (because display format is missing seconds, but in DB we still record them)

  5. confirm that: 

    • 0.5h

    • specifying one of from/to date only (no time) it works as before: range filter for given day

    • specifying one of from/to date with time it works by showing all records with that time (ignoring seconds)

    • specifying both from & to dates with time would show exactly that range of dates (ignoring seconds)

    • date & time entered in both output & input formats are recognized

  6. review connected task comments & commit

Context Information

None

Additional information (do not use)

None

Activity

Alex February 9, 2021 at 10:52 AM

alex closed D346: Correct time parsing in date range filter.
alex updated the diff for D346: Correct time parsing in date range filter.

Alex February 9, 2021 at 8:52 AM

alex added "INP-1746" JIRA issue(s) to rINP16669: Fixes - Correct time parsing in date range filter.

Alex February 9, 2021 at 8:52 AM

alex committed rINP16669: Fixes - Correct time parsing in date range filter.

Fixes - Correct time parsing in date range filter

Differential Revision: http://qa.in-portal.org/D346

Alex February 9, 2021 at 8:52 AM

alex closed D346: Correct time parsing in date range filter.
alex updated the diff for D346: Correct time parsing in date range filter.

[API] Administrator February 9, 2021 at 8:52 AM

User committed a fix to 5.2.x. Commit Message:

Fixes - Correct time parsing in date range filter

Differential Revision: http://qa.in-portal.org/D346

Fixed

Details

Priority

Assignee

Reporter

Developer

Reviewer

Change Log Group

Fixed

Change Log Message

Patch Instructions

Patches must be submitted through Phabricator.

Time tracking

3h 40m logged20m remaining

Story Points

Original estimate

Fix versions

Created July 31, 2018 at 10:25 AM
Updated December 29, 2024 at 8:49 PM
Resolved February 9, 2021 at 8:52 AM