コード例 #1
0
 /** Compute long due date from DateValue */
 private static long buildNewDueDate(DateTime original, DateValue nextDate) {
   long newDueDate;
   if (nextDate instanceof DateTimeValueImpl) {
     DateTimeValueImpl newDateTime = (DateTimeValueImpl) nextDate;
     DateTime date =
         newDateUtc(
                 newDateTime.year(),
                 newDateTime.month(),
                 newDateTime.day(),
                 newDateTime.hour(),
                 newDateTime.minute(),
                 newDateTime.second())
             .toLocal();
     // time may be inaccurate due to DST, force time to be same
     date =
         date.withHourOfDay(original.getHourOfDay()).withMinuteOfHour(original.getMinuteOfHour());
     newDueDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, date.getMillis());
   } else {
     newDueDate =
         Task.createDueDate(
             Task.URGENCY_SPECIFIC_DAY,
             newDate(nextDate.year(), nextDate.month(), nextDate.day()).getMillis());
   }
   return newDueDate;
 }
コード例 #2
0
 /** Compute long due date from DateValue */
 private static long buildNewDueDate(Date original, DateValue nextDate) {
   long newDueDate;
   if (nextDate instanceof DateTimeValueImpl) {
     DateTimeValueImpl newDateTime = (DateTimeValueImpl) nextDate;
     Date date =
         new Date(
             Date.UTC(
                 newDateTime.year() - 1900,
                 newDateTime.month() - 1,
                 newDateTime.day(),
                 newDateTime.hour(),
                 newDateTime.minute(),
                 newDateTime.second()));
     // time may be inaccurate due to DST, force time to be same
     date.setHours(original.getHours());
     date.setMinutes(original.getMinutes());
     newDueDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, date.getTime());
   } else {
     newDueDate =
         Task.createDueDate(
             Task.URGENCY_SPECIFIC_DAY,
             new Date(nextDate.year() - 1900, nextDate.month() - 1, nextDate.day()).getTime());
   }
   return newDueDate;
 }