fix: kalender divisi
Deskripsi: - on klik tanggal pertama kali > tampil tanggal salah No Issues
This commit is contained in:
@@ -8,7 +8,6 @@ import Styles from "@/constants/Styles";
|
||||
import { apiGetCalendarByDateDivision, apiGetIndicatorCalendar } from "@/lib/api";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { Feather } from "@expo/vector-icons";
|
||||
import dayjs from "dayjs";
|
||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||
import 'intl';
|
||||
import 'intl/locale-data/jsonp/id';
|
||||
@@ -53,7 +52,7 @@ export default function CalendarDivision() {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetCalendarByDateDivision({
|
||||
user: hasil,
|
||||
date: dayjs(selected).format("YYYY-MM-DD"),
|
||||
date: moment(selected).format("YYYY-MM-DD"),
|
||||
division: id,
|
||||
});
|
||||
setData(response.data);
|
||||
@@ -71,7 +70,7 @@ export default function CalendarDivision() {
|
||||
const hasil = await decryptToken(String(token?.current));
|
||||
const response = await apiGetIndicatorCalendar({
|
||||
user: hasil,
|
||||
date: dayjs(newDate).format("YYYY-MM-DD"),
|
||||
date: moment(newDate).format("YYYY-MM-DD"),
|
||||
division: id,
|
||||
});
|
||||
setDataIndicator(response.data);
|
||||
@@ -113,6 +112,7 @@ export default function CalendarDivision() {
|
||||
text={day.text}
|
||||
isSelected={day.isSelected}
|
||||
isSign={sign}
|
||||
onPress={() => setSelected(new Date(today))}
|
||||
/>
|
||||
);
|
||||
},
|
||||
@@ -156,7 +156,6 @@ export default function CalendarDivision() {
|
||||
mode="single"
|
||||
date={selected}
|
||||
month={month}
|
||||
onChange={({ date }) => setSelected(date)}
|
||||
onMonthChange={(month) => setMonth(month)}
|
||||
styles={{
|
||||
selected: Styles.selectedDate,
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import Styles from "@/constants/Styles";
|
||||
import { View } from "react-native";
|
||||
import { Pressable, View } from "react-native";
|
||||
import Text from "../Text";
|
||||
|
||||
type Props = {
|
||||
text: string;
|
||||
isSelected: boolean;
|
||||
isSign: boolean;
|
||||
onPress?: () => void;
|
||||
}
|
||||
|
||||
|
||||
export default function ItemDateCalendar({ text, isSelected, isSign }: Props) {
|
||||
export default function ItemDateCalendar({ text, isSelected, isSign, onPress }: Props) {
|
||||
return (
|
||||
<>
|
||||
<View style={{ alignItems: 'center' }}>
|
||||
<Pressable style={{ alignItems: 'center' }} onPress={onPress}>
|
||||
<Text style={[isSelected ? Styles.cWhite : Styles.cBlack]}>{text}</Text>
|
||||
<View style={[Styles.signDate, { backgroundColor: isSign ? 'red' : 'transparent' }]}></View>
|
||||
</View>
|
||||
</Pressable>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user