context.js 530 B

12345678910111213141516171819202122
  1. import React from 'react'
  2. import { CHINESE_MODEL, _, noop } from './const'
  3. import { getDaysOfMonth, getWeekSort } from './helper'
  4. const model = CHINESE_MODEL
  5. const days = getDaysOfMonth(_, _, model)
  6. const weekTags = getWeekSort(model)
  7. export const initialData = {
  8. model: model,
  9. days: days,
  10. weekTags: weekTags,
  11. onChangeModel: noop,
  12. onSelectDay: noop,
  13. onSelectToday: noop,
  14. onPrevMonth: noop,
  15. onPrevYear: noop,
  16. onNextMonth: noop,
  17. onNextYear: noop,
  18. }
  19. export const DateContext = React.createContext(initialData)