Attempts to restore accessibility focus to the specified date.

@param day The date which should receive focus
@return {@code false} if the date is not valid for this month view, or
{@code true} if the date received focus
346241
public boolean restoreAccessibilityFocus(CalendarDay day) {
        if ((day.year != mYear) || (day.month != mMonth) || (day.day > mNumCells)) {
            return false;
        }
        mTouchHelper.setFocusedVirtualView(day.day);
        return true;
    }
239030
public static boolean validate(final String date) {

        Matcher matcher = PATTERN.matcher(date);

        if (matcher.matches()) {

            matcher.reset();

            if (matcher.find()) {

                int year = Integer.parseInt(matcher.group(1));
                String month = matcher.group(2);
                String day = matcher.group(3);

                if (day.equals("31") && (month.equals("4") || month.equals("6") || month.equals("9") || month
                        .equals("11") || month.equals("04") || month.equals("06") || month.equals("09"))) {
                    return false; // only 1,3,5,7,8,10,12 has 31 days
                } else if (month.equals("2") || month.equals("02")) {
                    // leap year
                    if (year % 4 == 0) {
                        return !(day.equals("30") || day.equals("31"));
                    } else {
                        return !(day.equals("29") || day.equals("30") || day.equals("31"));
                    }
                } else {
                    return true;
                }
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
1150529
public static boolean specificToDay(String eventDate) { 
    	boolean result = false;
    	if (!isEmpty(eventDate)) { 
    	    Interval eventDateInterval = extractInterval(eventDate);
    	    logger.debug(eventDateInterval);
    	    logger.debug(eventDateInterval.toDuration());
    	    if (eventDateInterval.toDuration().getStandardDays()<1l) { 
    	    	result = true;
    	    } else if (eventDateInterval.toDuration().getStandardDays()==1l && eventDateInterval.getStart().getDayOfYear()==eventDateInterval.getEnd().getDayOfYear()) {
    	    	result = true;
    	    }
    	}
    	return result;
    }
434977
public boolean isSameDay(Day compared)
  {
	  if(compared == null)
		  return false;
	 
  	return this.getMonth() == compared.getMonth()
  	&& this.getDayOfMonth() == compared.getDayOfMonth()
  	&& this.getYear() == compared.getYear();
  }
532380
@SuppressLint("NewApi")
    @Override
    public boolean performAccessibilityAction(int action, Bundle arguments) {
        if (action != AccessibilityNodeInfo.ACTION_SCROLL_FORWARD &&
                action != AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
            return super.performAccessibilityAction(action, arguments);
        }

        // Figure out what month is showing.
        int firstVisiblePosition = getFirstVisiblePosition();
        int month = firstVisiblePosition % 12;
        int year = firstVisiblePosition / 12 + mController.getMinYear();
        CalendarDay day = new CalendarDay(year, month, 1);

        // Scroll either forward or backward one month.
        if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
            day.month++;
            if (day.month == 12) {
                day.month = 0;
                day.year++;
            }
        } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) {
            View firstVisibleView = getChildAt(0);
            // If the view is fully visible, jump one month back. Otherwise, we'll just jump
            // to the first day of first visible month.
            if (firstVisibleView != null && firstVisibleView.getTop() >= -1) {
                // There's an off-by-one somewhere, so the top of the first visible item will
                // actually be -1 when it's at the exact top.
                day.month--;
                if (day.month == -1) {
                    day.month = 11;
                    day.year--;
                }
            }
        }

        // Go to that month.
        DateTimePickerUtils.tryAccessibilityAnnounce(this, getMonthAndYearString(day));
        goTo(day, true, false, true);
        mPerformingScroll = true;
        return true;
    }
1195754
public void setDateVisible(final boolean VISIBLE) {
        if (null == dateVisible) {
            _dateVisible = VISIBLE;
            fireUpdateEvent(VISIBILITY_EVENT);
        } else {
            dateVisible.set(VISIBLE);
        }

    }
1098302
public void setDate(int day, int month, int year){
        if(mAdapter.getYear() == year && mAdapter.getMonth() == month && mAdapter.getDay() == day)
            return;

        mAdapter.setDate(day, month, year, false);
        goTo(month, year);
    }
998612
public static boolean isDate(String year, String month, String day) {
        // catch invalid years(not 2- or 4-digit) and invalid months and days.
        if (!(isYear(year) && isMonth(month) && isDay(day))) return false;

        int intYear = Integer.parseInt(year);
        int intMonth = Integer.parseInt(month);
        int intDay = Integer.parseInt(day);

        // catch invalid days, except for February
        if (intDay > daysInMonth[intMonth - 1]) return false;
        if ((intMonth == 2) && (intDay > daysInFebruary(intYear))) return false;
        return true;
    }
190157
public final void setWholeDay(Boolean isWholeDay) {

        m_isWholeDay = (null != isWholeDay) && isWholeDay.equals(Boolean.TRUE);

    }
1342127
@Override
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
        if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
            // Clear the event's current text so that only the current date will be spoken.
            event.getText().clear();
            int flags = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR |
                    DateUtils.FORMAT_SHOW_WEEKDAY;

            String dateString = DateUtils.formatDateTime(getContext(), mDateMillis, flags);
            event.getText().add(dateString);
            return true;
        }
        return super.dispatchPopulateAccessibilityEvent(event);
    }
684248
private void setCorrectDay(Calendar date) {

        if (monthHasNotDay(date)) {
            date.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
        } else {
            date.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
        }
    }
1149188
private static Calendar dateToCalendar(Date date) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		return cal;
	}
241865
public void setDateSelected(CalendarDay day, boolean selected) {
    if (selected) {
      if (!selectedDates.contains(day)) {
        selectedDates.add(day);
        invalidateSelectedDates();
      }
    } else {
      if (selectedDates.contains(day)) {
        selectedDates.remove(day);
        invalidateSelectedDates();
      }
    }
  }
1305528
private void onDayClick(CalendarDay day) {
        if (mOnDayClickListener != null) {
            mOnDayClickListener.onDayClick(this, day);
        }

        // This is a no-op if accessibility is turned off.
        mNodeProvider.sendEventForItem(day, AccessibilityEvent.TYPE_VIEW_CLICKED);
    }
1184604
public boolean isSameDay(Calendar calendar) {
		Calendar c1 = asCalendar();
		return (c1.get(Calendar.ERA) == calendar.get(Calendar.ERA) &&
				c1.get(Calendar.YEAR) == calendar.get(Calendar.YEAR) &&
				c1.get(Calendar.DAY_OF_YEAR) == calendar.get(Calendar.DAY_OF_YEAR));
	}
1317856
function (date) {
        var q = $q.defer();

        navigator.globalization.isDayLightSavingsTime(
          date,
          function (result) {
            q.resolve(result);
          },
          function (err) {
            q.reject(err);
          });
        return q.promise;
      }
1071930
private I_CmsListDateRestriction parseFromToday(CmsXmlContentValueLocation dateRestriction) {

        CmsXmlContentValueLocation location = dateRestriction.getSubValue(N_FROM_TODAY);
        if (location == null) {
            return null;
        }
        CmsXmlContentValueLocation countLoc = location.getSubValue(N_COUNT);
        CmsXmlContentValueLocation unitLoc = location.getSubValue(N_UNIT);
        CmsXmlContentValueLocation directionLoc = location.getSubValue(N_DIRECTION);

        TimeDirection direction = parseDirection(directionLoc);
        Integer count = parsePositiveNumber(countLoc);
        TimeUnit unit = parseUnit(unitLoc);
        if (count == null) {
            return null;
        }
        return new CmsListDateFromTodayRestriction(count.intValue(), unit, direction);
    }