Lines Matching refs:Month
108 * @param {!number} month
111 function formatJapaneseImperialEra(year, month) {
124 if (year == 1912 && month >= 7)
133 function createUTCDate(year, month, date) {
136 newDate.setUTCMonth(month);
143 * @return {?Day|Week|Month}
146 var month = Month.parse(dateString);
147 if (month)
148 return month;
189 * @param {!number} month
192 function Day(year, month, date) {
193 var dateObject = createUTCDate(year, month, date);
205 this.month = dateObject.getUTCMonth();
226 var month = parseInt(match[2], 10) - 1;
228 return new Day(year, month, date);
270 return other instanceof Day && this.year === other.year && this.month === other.month && this.date === other.date;
280 return new Day(this.year, this.month, this.date - offset);
290 return new Day(this.year, this.month, this.date + offset);
297 return createUTCDate(this.year, this.month, this.date);
304 return createUTCDate(this.year, this.month, this.date + 1);
332 return createUTCDate(this.year, this.month, this.date).getTime();
339 return createUTCDate(this.year, this.month, this.date).getUTCDay();
349 return yearString + "-" + ("0" + (this.month + 1)).substr(-2, 2) + "-" + ("0" + this.date).substr(-2, 2);
592 * @param {!number} month
594 function Month(year, month) {
599 this.year = year + Math.floor(month / MonthsPerYear);
604 this.month = month % MonthsPerYear < 0 ? month % MonthsPerYear + MonthsPerYear : month % MonthsPerYear;
607 Month.ISOStringRegExp = /^(\d+)-(\d+)$/;
610 Month.Minimum = new Month(1, 0);
611 Month.Maximum = new Month(275760, 8);
614 Month.DefaultStep = 1;
615 Month.DefaultStepBase = 0;
619 * @return {?Month}
621 Month.parse = function(str) {
622 var match = Month.ISOStringRegExp.exec(str);
626 var month = parseInt(match[2], 10) - 1;
627 return new Month(year, month);
632 * @return {!Month}
634 Month.createFromValue = function(monthsSinceEpoch) {
635 return new Month(1970, monthsSinceEpoch)
640 * @return {!Month}
642 Month.createFromDate = function(date) {
645 return new Month(date.getUTCFullYear(), date.getUTCMonth());
650 * @return {!Month}
652 Month.createFromDay = function(day) {
653 return new Month(day.year, day.month);
657 * @return {!Month}
659 Month.createFromToday = function() {
661 return new Month(now.getFullYear(), now.getMonth());
667 Month.prototype.containsDay = function(day) {
668 return this.year === day.year && this.month === day.month;
672 * @param {!Month} other
675 Month.prototype.equals = function(other) {
676 return other instanceof Month && this.year === other.year && this.month === other.month;
681 * @return {!Month}
683 Month.prototype.previous = function(offset) {
686 return new Month(this.year, this.month - offset);
691 * @return {!Month}
693 Month.prototype.next = function(offset) {
696 return new Month(this.year, this.month + offset);
702 Month.prototype.startDate = function() {
703 return createUTCDate(this.year, this.month, 1);
709 Month.prototype.endDate = function() {
710 if (this.equals(Month.Maximum))
718 Month.prototype.firstDay = function() {
719 return new Day(this.year, this.month, 1);
725 Month.prototype.middleDay = function() {
726 return new Day(this.year, this.month, this.month === 2 ? 14 : 15);
732 Month.prototype.lastDay = function() {
733 if (this.equals(Month.Maximum))
741 Month.prototype.valueOf = function() {
742 return (this.year - 1970) * MonthsPerYear + this.month;
748 Month.prototype.toString = function() {
752 return yearString + "-" + ("0" + (this.month + 1)).substr(-2, 2);
758 Month.prototype.toLocaleString = function() {
760 return "" + this.year + "?" + formatJapaneseImperialEra(this.year, this.month) + " " + (this.month + 1) + "?";
761 return window.pagePopupController.formatMonth(this.year, this.month);
767 Month.prototype.toShortLocaleString = function() {
768 return window.pagePopupController.formatShortMonth(this.year, this.month);
2138 * @type {!Array} Array of the 12 month button elements.
2146 var month = c + r * YearListCell.ButtonColumns;
2147 var button = createElement("button", YearListCell.ClassNameMonthButton, shortMonthLabels[month]);
2148 button.dataset.month = month;
2177 YearListCell.ClassNameMonthChooser = "month-chooser";
2178 YearListCell.ClassNameMonthButtonsRow = "month-buttons-row";
2179 YearListCell.ClassNameMonthButton = "month-button";
2224 * @param {!Month} minimumMonth
2225 * @param {!Month} maximumMonth
2232 * @type {?Month}
2236 * @type {!Month}
2242 * @type {!Month}
2298 this.highlightMonth(new Month(cell.row + 1, parseInt(monthButtonElement.dataset.month, 10)));
2310 this.highlightMonth(new Month(cell.row + 1, parseInt(monthButtonElement.dataset.month, 10)));
2405 var month = this.highlightedMonth ? this.highlightedMonth.month : 0;
2406 this.dispatchEvent(YearListView.EventTypeYearListViewDidSelectMonth, this, new Month(year, month));
2412 var month = parseInt(monthButton.dataset.month, 10);
2413 this.dispatchEvent(YearListView.EventTypeYearListViewDidSelectMonth, this, new Month(year, month));
2477 cell.monthButtons[this.highlightedMonth.month].classList.add(YearListCell.ClassNameHighlighted);
2480 var month = new Month(row + 1, i);
2481 cell.monthButtons[i].disabled = this._minimumMonth > month || this._maximumMonth < month;
2557 var month = this.highlightedMonth ? this.highlightedMonth.month : 0;
2558 this.highlightMonth(new Month(this.selectedRow + 1, month));
2579 var month = this.highlightedMonth ? this.highlightedMonth.month : 0;
2580 this.highlightMonth(new Month(this.selectedRow + 1, month));
2586 * @param {!Month} month
2589 YearListView.prototype.buttonForMonth = function(month) {
2590 if (!month)
2592 var row = month.year - 1;
2596 return cell.monthButtons[month.month];
2610 * @param {!Month} month
2612 YearListView.prototype.highlightMonth = function(month) {
2613 if (this.highlightedMonth && this.highlightedMonth.equals(month))
2616 this.highlightedMonth = month;
2626 * @param {!Month} month
2628 YearListView.prototype.show = function(month) {
2631 this.scrollToRow(month.year - 1, false);
2632 this.selectWithoutAnimating(month.year - 1);
2633 this.highlightMonth(month);
2641 * @param {!Month} month
2643 YearListView.prototype._moveHighlightTo = function(month) {
2644 this.highlightMonth(month);
2647 this.dispatchEvent(YearListView.EventTypeYearListViewDidSelectMonth, this, month);
2659 eventHandled = this._moveHighlightTo(Month.createFromToday());
2701 * @param {!Month} minimumMonth
2702 * @param {!Month} maximumMonth
2724 MonthPopupView.ClassNameMonthPopupView = "month-popup-view";
2792 MonthPopupButton.ClassNameMonthPopupButton = "month-popup-button";
2793 MonthPopupButton.ClassNameMonthPopupButtonLabel = "month-popup-button-label";
2803 var month = Month.Maximum;
2805 this.labelElement.textContent = month.toLocaleString();
2808 month = month.previous();
2815 * @param {!Month} month
2817 MonthPopupButton.prototype.setCurrentMonth = function(month) {
2818 this.labelElement.textContent = this._useShortMonth ? month.toShortLocaleString() : month.toLocaleString();
2961 var monthContainingToday = Month.createFromToday();
3015 var monthContainingToday = Month.createFromToday();
3043 DayCell.ClassNameCurrentMonth = "current-month";
3447 * @param {!Month} month
3450 CalendarTableView.prototype.scrollToMonth = function(month, animate) {
3451 var rowForFirstDayInMonth = this.columnAndRowForDay(month.firstDay()).row;
3583 else if (this.type === "month")
3584 this._dateTypeConstructor = Month;
3594 * @type {!Month}
3597 this.minimumMonth = Month.createFromDay(this.config.minimum.firstDay());
3599 * @type {!Month}
3602 this.maximumMonth = Month.createFromDay(this.config.maximum.lastDay());
3627 * @type {!Month}
3630 this._currentMonth = new Month(NaN, NaN);
3654 this.setCurrentMonth(Month.createFromDay(initialSelection.middleDay()), CalendarPicker.NavigationBehavior.None);
3657 this.setCurrentMonth(Month.createFromToday(), CalendarPicker.NavigationBehavior.None);
3688 * @param {!Month} month
3690 CalendarPicker.prototype.onYearListViewDidSelectMonth = function(sender, month) {
3691 this.setCurrentMonth(month, CalendarPicker.NavigationBehavior.None);
3707 // Month popup view might be attached to document.body.
3732 * @return {!Month}
3747 * @param {!Month} month
3750 CalendarPicker.prototype.setCurrentMonth = function(month, behavior) {
3751 if (month > this.maximumMonth)
3752 month = this.maximumMonth;
3753 else if (month < this.minimumMonth)
3754 month = this.minimumMonth;
3755 if (this._currentMonth.equals(month))
3757 this._currentMonth = month;
3832 var candidateCurrentMonth = Month.createFromDay(firstDayInSelection);
3834 // Change current month if the selection is not visible at all.
3837 // If the selection is partly visible, only change the current month if
3934 this.setCurrentMonth(Month.createFromDay(dateRange.middleDay()), CalendarPicker.NavigationBehavior.WithAnimation);