Commit 366d8116 by tungnq

TODO: Bổ sung chức năng xác định ngày hiện tại tôn chữ màu xanh

parent e5a34df6
......@@ -84,7 +84,14 @@ const FilterWeekView = ({ navigation }) => {
},
];
};
const isToday = (someDate) => {
const today = new Date();
return (
someDate.getDate() === today.getDate() &&
someDate.getMonth() === today.getMonth() &&
someDate.getFullYear() === today.getFullYear()
);
};
const mockEvents = createMockEvents();
const formatDateToString = (date) => {
......@@ -219,12 +226,29 @@ const FilterWeekView = ({ navigation }) => {
return (
<View style={styles.weekHeaderContainer}>
<View style={styles.timeColumnHeader} />
{weekDates.map((date, index) => (
<View key={index} style={styles.dayHeaderCell}>
<Text style={styles.dayHeaderText}>{getDayName(date)}</Text>
<Text style={styles.dayHeaderNumber}>{date.getDate()}</Text>
</View>
))}
{weekDates.map((date, index) => {
const isCurrentDay = isToday(date); // Gọi hàm kiểm tra
return (
<View key={index} style={styles.dayHeaderCell}>
<Text style={[
styles.dayHeaderText,
isCurrentDay && styles.dayHeaderTextToday
]}>
{getDayName(date)}
</Text>
<View style={isCurrentDay ? styles.dayHeaderNumberContainerToday : {}}>
<Text style={[
styles.dayHeaderNumber,
isCurrentDay && styles.dayHeaderNumberToday
]}>
{date.getDate()}
</Text>
</View>
</View>
);
})}
</View>
);
};
......@@ -361,6 +385,17 @@ const styles = StyleSheet.create({
fontFamily: R.fonts.fontMedium,
color: R.colors.black,
},
dayHeaderNumberContainerToday: {
borderRadius: 15,
justifyContent: 'center',
alignItems: 'center',
},
dayHeaderNumberToday: {
color: R.colors.blue,
fontFamily: R.fonts.fontMedium,
fontSize: R.fontsize.fontSizeContent,
},
timeSlotsContainer: {
flex: 1,
backgroundColor: R.colors.white,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment