commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-350) New RandomDateUtils class in the lang.time package
Date Mon, 19 Nov 2007 20:52:43 GMT

    [ https://issues.apache.org/jira/browse/LANG-350?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543684
] 

Henri Yandell commented on LANG-350:
------------------------------------


I'd like to see method names of:

randomDate(Date, Date)
randomDateAfter(Date)
randomDateBefore(Date)

Plus it seems that you would also want:

randomDate()

As a date somewhere beyond our species' extinction is a bit crap, I could see you also wanting:

randomDateAfter(Date, int errorValue)
randomDateAfter(Date, int errorValue)

Where errorValue is a spread. ie:

randomDateAfter(Date, DateUtils.MILLIS_PER_DAY*365)

However that gets into the whole danger value of Calendar - ie) saying DateUtils.MILLIS_PER_YEAR
is not possible, and you'd want this to be in JODA Time instead.

The midnight one is a bit worrying - that implies Calendar usage via DateUtils and flags up
"JDK is crap" flags. 

> New RandomDateUtils class in the lang.time package
> --------------------------------------------------
>
>                 Key: LANG-350
>                 URL: https://issues.apache.org/jira/browse/LANG-350
>             Project: Commons Lang
>          Issue Type: New Feature
>    Affects Versions: 2.3
>            Reporter: Nathan Silberman
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: RandomDateUtils.java, RandomDateUtilsTest.java
>
>
> A new RandomDateUtils class that would provide methods for returning random datetimes
and random simple dates. Its functionality would include but not limited to the following:

> /* 
>  * Random datetime after Janurary 1st, 1970
>  */
> public static Date randomDate();
> /* 
>  * A Random datetime after the given date
>  */
> public static Date randomDateAfter( Date date );
> /* 
>  * A Random datetime before the given date
>  */
> public static Date randomDateBefore( Date date );
> /* 
>  * Random datetime after this instant
>  */
> public static Date randomFutureDate();
> /* 
>  * Random datetime before this instant
>  */
> public static Date randomPastDate();
> /* 
>  * Random date (zeroed out time) after Janurary 1st, 1970
>  */
> public static Date randomSimpleDate();
> /* 
>  * A Random date (zeroed out time) after the given date
>  */
> public static Date randomSimpleDateAfter( Date date );
> /* 
>  * A Random date (zeroed out time) before the given date
>  */
> public static Date randomSimpleDateBefore( Date date );
> /* 
>  * Random date (zeroed out time) after this instant
>  */
> public static Date randomSimpleFutureDate();
> /* 
>  * Random date (zeroed out time) before this instant
>  */
> public static Date randomSimplePastDate();

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


Mime
View raw message