Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

30 строки
822 B

  1. import toDate from '../toDate/index.js';
  2. import requiredArgs from '../_lib/requiredArgs/index.js';
  3. /**
  4. * @name getMonth
  5. * @category Month Helpers
  6. * @summary Get the month of the given date.
  7. *
  8. * @description
  9. * Get the month of the given date.
  10. *
  11. * ### v2.0.0 breaking changes:
  12. *
  13. * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).
  14. *
  15. * @param {Date|Number} date - the given date
  16. * @returns {Number} the month
  17. * @throws {TypeError} 1 argument required
  18. *
  19. * @example
  20. * // Which month is 29 February 2012?
  21. * var result = getMonth(new Date(2012, 1, 29))
  22. * //=> 1
  23. */
  24. export default function getMonth(dirtyDate) {
  25. requiredArgs(1, arguments);
  26. var date = toDate(dirtyDate);
  27. var month = date.getMonth();
  28. return month;
  29. }