ywana-core8 0.0.551 → 0.0.552

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ywana-core8",
3
- "version": "0.0.551",
3
+ "version": "0.0.552",
4
4
  "description": "ywana-core8",
5
5
  "homepage": "https://ywana.github.io/workspace",
6
6
  "author": "Ernesto Roldan Garcia",
@@ -10,7 +10,7 @@ const moment = extendMoment(Moment)
10
10
 
11
11
  export const Calendar = (props) => {
12
12
 
13
- const { events = [], children} = props
13
+ const { events = [], children, onChange } = props
14
14
  const [position, setPosition] = useState()
15
15
 
16
16
  useEffect(() => {
@@ -18,6 +18,17 @@ export const Calendar = (props) => {
18
18
  setPosition(today)
19
19
  }, [])
20
20
 
21
+ useEffect(() => {
22
+ if (onChange) {
23
+ const firstDayOfMonth = position.clone().startOf('month');
24
+ const firstDayOfRange = firstDayOfMonth.clone().startOf('isoweek');
25
+ const lastDayOfMonth = position.clone().endOf('month');
26
+ const lastDayOfRange = lastDayOfMonth.clone().endOf('isoweek');
27
+ const range = moment.range(firstDayOfRange, lastDayOfRange)
28
+ onChange(position, range)
29
+ }
30
+ }, [position])
31
+
21
32
  function next() {
22
33
  const next = position.clone().add(1, 'month')
23
34
  setPosition(next)