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 }) => { ...@@ -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 mockEvents = createMockEvents();
const formatDateToString = (date) => { const formatDateToString = (date) => {
...@@ -219,12 +226,29 @@ const FilterWeekView = ({ navigation }) => { ...@@ -219,12 +226,29 @@ const FilterWeekView = ({ navigation }) => {
return ( return (
<View style={styles.weekHeaderContainer}> <View style={styles.weekHeaderContainer}>
<View style={styles.timeColumnHeader} /> <View style={styles.timeColumnHeader} />
{weekDates.map((date, index) => ( {weekDates.map((date, index) => {
const isCurrentDay = isToday(date); // Gọi hàm kiểm tra
return (
<View key={index} style={styles.dayHeaderCell}> <View key={index} style={styles.dayHeaderCell}>
<Text style={styles.dayHeaderText}>{getDayName(date)}</Text> <Text style={[
<Text style={styles.dayHeaderNumber}>{date.getDate()}</Text> 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>
);
})}
</View> </View>
); );
}; };
...@@ -361,6 +385,17 @@ const styles = StyleSheet.create({ ...@@ -361,6 +385,17 @@ const styles = StyleSheet.create({
fontFamily: R.fonts.fontMedium, fontFamily: R.fonts.fontMedium,
color: R.colors.black, 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: { timeSlotsContainer: {
flex: 1, flex: 1,
backgroundColor: R.colors.white, 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