MCPcopy Create free account
hub / github.com/OneBitCodeBlog/onebitlife / onChange

Function onChange

src/Components/HabitPage/TimeDataPicker/index.jsx:20–43  ·  view source on GitHub ↗
(_, selectDate)

Source from the content-addressed store, hash-verified

18 const [notificationTime, setNotificationTime] = useState();
19
20 const onChange = (_, selectDate) => {
21 const currentDate = selectDate || date;
22 setShow(Platform.OS === "ios");
23 setDate(currentDate);
24 let tempDate = new Date(currentDate);
25 const notficationHour = tempDate.getHours().toString().padStart(2, "0");
26 const notficationMin = tempDate.getMinutes().toString().padStart(2, "0");
27 let dateNotification;
28
29 if (frequency === "Semanal") {
30 dateNotification = selected;
31 }
32 const timeNotification = `${notficationHour}:${notficationMin}`;
33
34 setNotificationDate(dateNotification);
35 setNotificationTime(timeNotification);
36
37 if (frequency === "Diário") {
38 setDayNotification("Diário");
39 } else {
40 setDayNotification(dateNotification);
41 }
42 setTimeNotification(timeNotification);
43 };
44 const showMode = (currentMode) => {
45 setShow(true);
46 setMode(currentMode);

Callers 1

TimeDataPickerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected