mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 15:33:09 +00:00
[DS-610] Check granularity before returning DCDate as a java.util.Date.
git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5159 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -287,18 +287,17 @@ public class DCDate
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the date as a Java Date object
|
* Get the date as a Java Date object, assuming the granularity is sufficient for it to be expressed as a Date.
|
||||||
*
|
*
|
||||||
* @return a Date object
|
* @return a Date object
|
||||||
*/
|
*/
|
||||||
public Date toDate()
|
public Date toDate()
|
||||||
{
|
{
|
||||||
if (calendar == null)
|
if ((calendar == null) || (!withinGranularity(DateGran.DAY)))
|
||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
return calendar.getTime();
|
return calendar.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the date. The date passed in is assumed to be in the current time
|
* Set the date. The date passed in is assumed to be in the current time
|
||||||
* zone, and is adjusting to fit the current time zone. Unknown values
|
* zone, and is adjusting to fit the current time zone. Unknown values
|
||||||
@@ -317,6 +316,7 @@ public class DCDate
|
|||||||
* @param ss
|
* @param ss
|
||||||
* the seconds
|
* the seconds
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setDateLocal(int yyyy, int mm, int dd, int hh, int mn, int ss)
|
public void setDateLocal(int yyyy, int mm, int dd, int hh, int mn, int ss)
|
||||||
{
|
{
|
||||||
// default values
|
// default values
|
||||||
|
Reference in New Issue
Block a user