Object parse(final String data) { try { final DateTimeFormatter parseFormat = DateTimeFormat.forPattern(ISO_FORMAT); final DateTime date = parseFormat.withZone(DateTimeZone.UTC).parseDateTime(data); final DateTimeZone dateTimeZone = ThreadLocalUserContext.getDateTimeZone(); return new DateTime(date, dateTimeZone); } catch (final Exception ex) { log.error("Can't parse DateMidnight: " + data); return new DateMidnight(); } }
public JodaDateConverter() { this.userDateFormat = getPattern(); this.timeZone = ThreadLocalUserContext.getDateTimeZone(); this.currentYear = new DateMidnight(timeZone).getYear(); }
/** * @param startDate * @return this for chaining. */ public CalendarPage setStartDate(final Date startDate) { form.getFilter().setStartDate(new DateMidnight(startDate, ThreadLocalUserContext.getDateTimeZone())); return this; }
DateTime holidaysFrom = new DateTime(ThreadLocalUserContext.getDateTimeZone()); holidaysFrom = holidaysFrom.dayOfYear().withMinimumValue().millisOfDay().withMinimumValue().minusYears(2); final DateTime holidayTo = holidaysFrom.plusYears(6);
private List<TimesheetDO> findTimesheets() { final DateTimeZone usersTimeZone = ThreadLocalUserContext.getDateTimeZone(); final Date fromDate = form.getTimePeriod().getFromDate(); final DateTime startDate = new DateTime(fromDate, usersTimeZone).withDayOfWeek(DateTimeConstants.MONDAY); final TimesheetFilter tf = new TimesheetFilter(); //ASC = Montag bis Sonntag tf.setOrderType(OrderDirection.ASC); tf.setStartTime(startDate.toDate()); tf.setUserId(this.getUserId()); //stopDate auf Sonntag 23:59:59.999 setzten um alle Eintragungen aus der Woche zu bekommen DateTime stopDate = startDate.withDayOfWeek(DateTimeConstants.SUNDAY); stopDate = stopDate.plusHours(23); stopDate = stopDate.plusMinutes(59); stopDate = stopDate.plusSeconds(59); stopDate = stopDate.plusMillis(999); tf.setStopTime(stopDate.toDate()); tf.setRecursive(true); return timesheetDao.getList(tf); } }
continue; final DateTime week = new DateTime(planning.getWeek(), ThreadLocalUserContext.getDateTimeZone()); for (final HRPlanningEntryDO entry : planning.getEntries()) { if (entry.isDeleted() == true) {
@Override protected void respond(final AjaxRequestTarget target) { final Request r = target.getPage().getRequest(); final ViewType type = ViewType.forCode(r.getRequestParameters().getParameterValue("view").toString()); final DateTimeFormatter fmt = ISODateTimeFormat.dateTimeParser().withZone(ThreadLocalUserContext.getDateTimeZone()); final DateMidnight start = fmt.parseDateTime(r.getRequestParameters().getParameterValue("start").toString()) .toDateMidnight(); final DateMidnight end = fmt.parseDateTime(r.getRequestParameters().getParameterValue("end").toString()) .toDateMidnight(); final DateMidnight visibleStart = fmt.parseDateTime( r.getRequestParameters().getParameterValue("visibleStart").toString()).toDateMidnight(); final DateMidnight visibleEnd = fmt .parseDateTime(r.getRequestParameters().getParameterValue("visibleEnd").toString()).toDateMidnight(); final View view = new View(type, start, end, visibleStart, visibleEnd); final CalendarResponse response = new CalendarResponse(getCalendar(), target); onViewDisplayed(view, response); }
} else { final DateTime currentMonth = new DateTime(start.plusDays(10), ThreadLocalUserContext.getDateTimeZone()); // Now we're definitely in the right DateTime lastStopTime = null; for (final TimesheetDO timesheet : timesheets) { final DateTime startTime = new DateTime(timesheet.getStartTime(), ThreadLocalUserContext.getDateTimeZone()); final DateTime stopTime = new DateTime(timesheet.getStopTime(), ThreadLocalUserContext.getDateTimeZone()); if (stopTime.isBefore(start) == true || startTime.isAfter(end) == true) {
final DateTimeZone dateTimeZone = eventDO.isAllDay() ? DateTimeZone.forTimeZone(DateHelper.UTC) : ThreadLocalUserContext.getDateTimeZone(); final DateTime startDate = new DateTime(teamEvent.getStartDate(), dateTimeZone); final DateTime endDate = new DateTime(teamEvent.getEndDate(), dateTimeZone);