Commons Lang
  1. Commons Lang
  2. LANG-400

Add DateUtils methods to implement before and after time-insensitive

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The JDK contains Date.before() and Date.after() but no time-insensitive versions exist. I am typically in the situation where TIMESTAMP columns are converted into Date instances and I need to compare dates only for business rules.

      I propose to complement DateUtils.isSameDay:
      DateUtils.isBeforeDay
      DateUtils.isAfterDay

      My private implementations convert Date to Calendar, zero-out the time elements, and then compare.

      PS: I would also deprecate isSameXXX methods in 2.4 and rename it to isEqualXXX since sameness usually implies instance equality, rather than object equality.

        Activity

        Paul Benedict created issue -
        pbenedict made changes -
        Field Original Value New Value
        Description The JDK contains Date.before() and Date.after() but no time-insensitive versions exist. I am typically in the situation where TIMESTAMP columns are converted into Date instances and I need to compare dates only for business rules.

        I propose to complete DateUtils.isSameDay:
        DateUtils.isBeforeDay
        DateUtils.isAfterDay

        My private implementations convert Date to Calendar, zero-out the time elements, and then compare.

        PS: I would also deprecate isSameXXX methods in 2.4 and rename it to isEqualXXX since sameness usually implies instance equality, rather than object equality.
        The JDK contains Date.before() and Date.after() but no time-insensitive versions exist. I am typically in the situation where TIMESTAMP columns are converted into Date instances and I need to compare dates only for business rules.

        I propose to complement DateUtils.isSameDay:
        DateUtils.isBeforeDay
        DateUtils.isAfterDay

        My private implementations convert Date to Calendar, zero-out the time elements, and then compare.

        PS: I would also deprecate isSameXXX methods in 2.4 and rename it to isEqualXXX since sameness usually implies instance equality, rather than object equality.
        Henri Yandell made changes -
        Fix Version/s 3.0 [ 12311714 ]
        Fix Version/s 2.4 [ 12312481 ]
        Henri Yandell made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s Commons Time? [ 12314080 ]
        Fix Version/s 3.0 [ 12311714 ]
        Resolution Won't Fix [ 2 ]
        Mark Thomas made changes -
        Workflow jira [ 12420593 ] Default workflow, editable Closed status [ 12602596 ]
        Henri Yandell made changes -
        Fix Version/s Commons Time? [ 12314080 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Paul Benedict
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development