Subversion Repository Public Repository

litesoft

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.litesoft.core.typeutils.gregorian;

import org.litesoft.core.simpletypes.temporal.*;

public class Dates
{
    public static CalendarYMD forceEndOfMonth( CalendarYMD pCalendarYMD )
    {
        return (pCalendarYMD == null) ? null : pCalendarYMD.forceEndOfMonth();
    }

    /**
     * Returns null if a valid date, or error text if not!
     */
    public static String checkValidity( int pYear, int pMonth, int pDay )
    {
        Month zMonth = Month.fromMonthNumber( pMonth );
        if ( zMonth == null )
        {
            return "Invalid month: " + pMonth;
        }
        if ( pDay < 1 )
        {
            return "Invalid day: " + pDay;
        }
        int maxDaysInMonth = zMonth.daysIn( pYear );
        if ( maxDaysInMonth < pDay )
        {
            return zMonth.name() + " " + pYear + " only has " + maxDaysInMonth + ", attempted to set days to: " + pDay;
        }
        return null;
    }
}

Commits for litesoft/trunk/Java/core/Anywhere/src/org/litesoft/core/typeutils/gregorian/Dates.java

Diff revisions: vs.
Revision Author Commited Message
860 Diff Diff GeorgeS picture GeorgeS Mon 05 Nov, 2012 01:39:02 +0000
858 Diff Diff GeorgeS picture GeorgeS Sun 04 Nov, 2012 18:40:40 +0000
851 Diff Diff GeorgeS picture GeorgeS Mon 08 Oct, 2012 00:05:32 +0000

Breaking the code as Temporal changes are implemented...

823 Diff Diff GeorgeS picture GeorgeS Sun 19 Aug, 2012 16:10:13 +0000
819 GeorgeS picture GeorgeS Sat 18 Aug, 2012 18:09:40 +0000