How to use the react-calendar/build/shared/dates.getDay function in react-calendar

To help you get started, we’ve selected a few react-calendar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wojtekmaj / react-date-picker / build / shared / dates.js View on Github external
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getISOLocalDate = exports.getISOLocalMonth = exports.getMonth = exports.getEnd = exports.getBegin = exports.getDaysInMonth = exports.getDay = exports.getMonthIndex = exports.getYear = undefined;

var _dates = require('react-calendar/build/shared/dates');

exports.getYear = _dates.getYear;
exports.getMonthIndex = _dates.getMonthIndex;
exports.getDay = _dates.getDay;
exports.getDaysInMonth = _dates.getDaysInMonth;
exports.getBegin = _dates.getBegin;
exports.getEnd = _dates.getEnd;

/* Simple getters - getting a property of a given point in time */

var getMonth = exports.getMonth = function getMonth(date) {
  return date.getMonth() + 1;
};

/* Complex getters - getting a property somehow related to a given point in time */

/**
 * Returns local month in ISO-like format (YYYY-MM).
 */
var getISOLocalMonth = exports.getISOLocalMonth = function getISOLocalMonth(value) {
github wojtekmaj / react-date-picker / build / shared / dates.js View on Github external
var getISOLocalDate = exports.getISOLocalDate = function getISOLocalDate(value) {
  if (!value) {
    return value;
  }

  if (!(value instanceof Date)) {
    throw new Error('Invalid date: ' + value);
  }

  var year = (0, _dates.getYear)(value);
  var month = ('0' + getMonth(value)).slice(-2);
  var day = ('0' + (0, _dates.getDay)(value)).slice(-2);

  return year + '-' + month + '-' + day;
};