DateObject::limitGranularity() doesn't work when passed array contains zeroes

Created on 11 July 2012, over 12 years ago
Updated 25 March 2023, over 1 year ago

When you pass field settings with at least one zero value to the DateObject::limitGranularity(), it doesn't filter out anything, because non-strict comparison returns match for any granularity string and integer zero.

Patch follows.

🐛 Bug report
Status

RTBC

Version

2.0

Component

Date API

Created by

🇵🇹Portugal dmitriy.trt

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States spiritcapsule

    reroll of #7

  • Status changed to RTBC over 1 year ago
  • 🇮🇳India rckstr_rohan

    reviewed patch on #10 , DateObject::limitGranularity() issue is resolved.

  • First commit to issue fork.
  • @kunal_sahu opened merge request.
  • 🇮🇳India kunal_sahu Karnataka

    Hi @all,

    I have tested this patch . The patch LGTM.

    $ git apply -v date-1679552-10.patch.patch
    Checking patch date_api/date_api.module...
    Checking patch date_api/tests/DateApiTestCase.test...
    Applied patch date_api/date_api.module cleanly.
    Applied patch date_api/tests/DateApiTestCase.test cleanly.

    And this does solves the issue.

    RTBC++.

    Provided an MR for helping the maintainer.

    Please merge.

    Thanks

Production build 0.71.5 2024