mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-14 21:43:11 +00:00
SF patch [2385187] Fix for toDate method in DCDateSF
git-svn-id: http://scm.dspace.org/svn/repo/branches/dspace-1_5_x@3367 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -244,12 +244,59 @@ public class DCDate
|
|||||||
*/
|
*/
|
||||||
public Date toDate()
|
public Date toDate()
|
||||||
{
|
{
|
||||||
|
int tmpmonth;
|
||||||
|
int tmpday;
|
||||||
|
int tmphours;
|
||||||
|
int tmpmin;
|
||||||
|
int tmpsec;
|
||||||
|
|
||||||
|
if (month < 0) {
|
||||||
|
// Month is unknown and set to -1
|
||||||
|
// but GregorianCalendar will interpret this as a rollback
|
||||||
|
// to December of the previous year
|
||||||
|
tmpmonth = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Month is known, but GC calendar is 0 - 11, not 1 - 12
|
||||||
|
// so we'll do subtraction here
|
||||||
|
tmpmonth = month - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (day < 0) {
|
||||||
|
tmpday = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmpday = day;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hours < 0) {
|
||||||
|
tmphours = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmphours = hours;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minutes < 0) {
|
||||||
|
tmpmin = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmpmin = minutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (seconds < 0) {
|
||||||
|
tmpsec = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tmpsec = seconds;
|
||||||
|
}
|
||||||
|
|
||||||
GregorianCalendar utcGC = new GregorianCalendar(TimeZone
|
GregorianCalendar utcGC = new GregorianCalendar(TimeZone
|
||||||
.getTimeZone("UTC"));
|
.getTimeZone("UTC"));
|
||||||
|
|
||||||
utcGC.set(year, month - 1, day, hours, minutes, seconds);
|
utcGC.set(year, tmpmonth, tmpday, tmphours, tmpmin, tmpsec);
|
||||||
|
|
||||||
return utcGC.getTime();
|
return utcGC.getTime();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -37,6 +37,9 @@
|
|||||||
- Fixed small bug in XMLUI's org.dspace.app.xmlui.cocoon.DSpaceMETSGenerator which caused Repository-wide METS file to fail to generate.
|
- Fixed small bug in XMLUI's org.dspace.app.xmlui.cocoon.DSpaceMETSGenerator which caused Repository-wide METS file to fail to generate.
|
||||||
- [2477820] DSpace 1.5 XMLUI - Enable METS <amdSec> using crosswalks
|
- [2477820] DSpace 1.5 XMLUI - Enable METS <amdSec> using crosswalks
|
||||||
|
|
||||||
|
(Kim Shepherd)
|
||||||
|
- [2385187] Fix for toDate method in DCDate
|
||||||
|
|
||||||
1.5.1 final
|
1.5.1 final
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user