From df53c2dd97605be1cee04396126ad31eca93ac76 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Mon, 11 Feb 2013 13:52:08 +0100 Subject: [PATCH] tim-connector: Use LocalDate API It makes code simpler than using Calendar API, and it's the common way to manage dates into LibrePlan. FEA: ItEr77S16JiraAndTimConnectorContributionIntegration --- .../org/libreplan/importers/ExportTimesheetsToTim.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java b/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java index 1f7ec224b..faca2d7c8 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java +++ b/libreplan-webapp/src/main/java/org/libreplan/importers/ExportTimesheetsToTim.java @@ -20,7 +20,6 @@ package org.libreplan.importers; import java.util.ArrayList; -import java.util.Calendar; import java.util.Collections; import java.util.Date; import java.util.List; @@ -28,6 +27,7 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.joda.time.LocalDate; import org.libreplan.business.common.IAdHocTransactionService; import org.libreplan.business.common.IOnTransaction; import org.libreplan.business.common.daos.IAppPropertiesDAO; @@ -150,11 +150,12 @@ public class ExportTimesheetsToTim implements IExportTimesheetsToTim { int nrDaysTimesheetToTim = Integer.parseInt(appProperties .get("NrDaysTimesheetToTim")); - Calendar dateNrOfDaysBack = Calendar.getInstance(); - dateNrOfDaysBack.add(Calendar.DAY_OF_MONTH, -nrDaysTimesheetToTim); + LocalDate dateNrOfDaysBack = new LocalDate() + .minusDays(nrDaysTimesheetToTim); List workReportLines = order.getWorkReportLines( - new Date(dateNrOfDaysBack.getTimeInMillis()), new Date(), true); + dateNrOfDaysBack.toDateTimeAtStartOfDay().toDate(), new Date(), + true); if (workReportLines == null || workReportLines.isEmpty()) { LOG.warn("No work reportlines are found"); return false;