You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Paul Benedict (JIRA)" <ji...@apache.org> on 2008/01/10 07:42:33 UTC

[jira] Created: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Add DateUtils methods to implement before and after time-insensitive
--------------------------------------------------------------------

                 Key: LANG-400
                 URL: https://issues.apache.org/jira/browse/LANG-400
             Project: Commons Lang
          Issue Type: New Feature
    Affects Versions: 2.3
            Reporter: Paul Benedict
             Fix For: 2.4


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558013#action_12558013 ] 

Paul Benedict commented on LANG-400:
------------------------------------

I will provide a patch.

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Gary Gregory (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557733#action_12557733 ] 

Gary Gregory commented on LANG-400:
-----------------------------------

IMO, this is not realistic, [lang] should not end up will all of the features everyone needs in order for people to just one library (or a small set of libraries) It would be a shame and wasted effort if lang duplicates features from other open source libraries. The Date topic can grow into size and complexity rapidly. Personally, I would rather not have date features start to leak in and continue to grow over releases until we end up with the functional duplication of Joda-Time in lang.

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-400.
------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: 3.0)
                   Commons Time?

Closing and pointing to JODA Time. Setting fix version to "Commons Time?".

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: Commons Time?
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557791#action_12557791 ] 

Paul Benedict commented on LANG-400:
------------------------------------

But Joda Time is a very sophisticated library that deals with new types of objects. I am not asking for new date-time abstractions, just supporting functions to deal with standard JDK solutions.

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated LANG-400:
-------------------------------

    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.

  was:
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.


> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Gary Gregory (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557565#action_12557565 ] 

Gary Gregory commented on LANG-400:
-----------------------------------

I always ask this when [lang] and date features are mentioned: Would Joda-Time fit your needs now?

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557902#action_12557902 ] 

Henri Yandell commented on LANG-400:
------------------------------------

Yep - we should only add features if they enhance the existing functionality and don't butt into any of the design 'quirks' of Java time. 

I wonder if the best way is to add an overload called truncateTime(Date) that handles your zero-out section. Seems like that would fit comfortably with the existing API, and yet still take care of the majority of your effort.

As to renaming isSameXXX to isEqualXXX - I think we should stay as is because the English usage of 'Same' is more applicable to the time context. The spoken language isn't used to considering time as a numerical object as Java is, and so there is some benefit to the current name. Given that - we shouldn't mess with the API naming. 

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated LANG-400:
-------------------------------

    Fix Version/s:     (was: 2.4)
                   3.0

Kicking up to 3.0 until a patch shows.

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 3.0
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12558012#action_12558012 ] 

Paul Benedict commented on LANG-400:
------------------------------------

Unfortunately Java has no way to just deal with dates without dealing with time too. It's just their philosophy that dates exist on a time continuum. Anyway, truncateTime() would do fine, but I don't think that eliminates the need for isBeforeDay/isAfterDay(). Those methods I still need in many projects and they complement the already existing isSameDay().

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (LANG-400) Add DateUtils methods to implement before and after time-insensitive

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557718#action_12557718 ] 

Paul Benedict commented on LANG-400:
------------------------------------

I have no idea. I would rather stick to less libraries and use Commons Lang.

> Add DateUtils methods to implement before and after time-insensitive
> --------------------------------------------------------------------
>
>                 Key: LANG-400
>                 URL: https://issues.apache.org/jira/browse/LANG-400
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Paul Benedict
>             Fix For: 2.4
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.