mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 10:04:21 +00:00
[DS-497] Date month and day get default values when user returns to describe form
git-svn-id: http://scm.dspace.org/svn/repo/dspace/branches/dspace-1_6_x@4892 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -384,7 +384,7 @@ public class DCDate
|
||||
*/
|
||||
public int getYear()
|
||||
{
|
||||
return getLocalCalendar() == null ? -1 : localCalendar.get(Calendar.YEAR);
|
||||
return ((getLocalCalendar() == null) || (!withinGranularity(DateGran.YEAR))) ? -1 : localCalendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,7 +394,7 @@ public class DCDate
|
||||
*/
|
||||
public int getMonth()
|
||||
{
|
||||
return getLocalCalendar() == null ? -1 : localCalendar.get(Calendar.MONTH) + 1;
|
||||
return ((getLocalCalendar() == null) || (!withinGranularity(DateGran.MONTH))) ? -1 : localCalendar.get(Calendar.MONTH) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -404,7 +404,7 @@ public class DCDate
|
||||
*/
|
||||
public int getDay()
|
||||
{
|
||||
return getLocalCalendar() == null ? -1 : localCalendar.get(Calendar.DAY_OF_MONTH);
|
||||
return ((getLocalCalendar() == null) || (!withinGranularity(DateGran.DAY))) ? -1 : localCalendar.get(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -524,6 +524,52 @@ public class DCDate
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the requested level of granularity is within that of the date.
|
||||
*
|
||||
* @param dg
|
||||
* The requested level of granularity.
|
||||
* @return
|
||||
* true or false.
|
||||
*
|
||||
*/
|
||||
private boolean withinGranularity(DateGran dg)
|
||||
{
|
||||
if (granularity == DateGran.TIME)
|
||||
{
|
||||
if ((dg == DateGran.TIME) || (dg == DateGran.DAY) || (dg == DateGran.MONTH) || (dg == DateGran.YEAR))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (granularity == DateGran.DAY)
|
||||
{
|
||||
if ((dg == DateGran.DAY) || (dg == DateGran.MONTH) || (dg == DateGran.YEAR))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (granularity == DateGran.MONTH)
|
||||
{
|
||||
if ((dg == DateGran.MONTH) || (dg == DateGran.YEAR))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (granularity == DateGran.YEAR)
|
||||
{
|
||||
if (dg == DateGran.YEAR)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple test program
|
||||
* Usage: java org.dspace.content.DCdate [DCDate | -l yyyy [mm [dd ..]]] ]
|
||||
|
@@ -1,6 +1,9 @@
|
||||
1.6.1
|
||||
=====
|
||||
|
||||
(Robin Taylor)
|
||||
- [DS-497] Date month and day get default values when user returns to describe form
|
||||
|
||||
(Keiji Suzuki)
|
||||
- [DS-537] Malformed Japanese option values in the authority lookup window
|
||||
|
||||
|
Reference in New Issue
Block a user