getDefaultOptions.js 921 B

1234567891011121314151617181920212223242526272829303132
  1. import { getDefaultOptions as getInternalDefaultOptions } from "./_lib/defaultOptions.js";
  2. /**
  3. * @name getDefaultOptions
  4. * @category Common Helpers
  5. * @summary Get default options.
  6. * @pure false
  7. *
  8. * @description
  9. * Returns an object that contains defaults for
  10. * `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`
  11. * arguments for all functions.
  12. *
  13. * You can change these with [setDefaultOptions](https://date-fns.org/docs/setDefaultOptions).
  14. *
  15. * @returns The default options
  16. *
  17. * @example
  18. * const result = getDefaultOptions()
  19. * //=> {}
  20. *
  21. * @example
  22. * setDefaultOptions({ weekStarsOn: 1, firstWeekContainsDate: 4 })
  23. * const result = getDefaultOptions()
  24. * //=> { weekStarsOn: 1, firstWeekContainsDate: 4 }
  25. */
  26. export function getDefaultOptions() {
  27. return Object.assign({}, getInternalDefaultOptions());
  28. }
  29. // Fallback for modularized imports:
  30. export default getDefaultOptions;