|
@@ -18,7 +18,8 @@ const TripItem = ({ item, isNew }: { item: TripsData; isNew?: boolean }) => {
|
|
|
const navigation = useNavigation();
|
|
const navigation = useNavigation();
|
|
|
const [showAllRegions, setShowAllRegions] = useState(false);
|
|
const [showAllRegions, setShowAllRegions] = useState(false);
|
|
|
|
|
|
|
|
- const formatDate = (dateString: string) => {
|
|
|
|
|
|
|
+ const formatDate = (dateString: string | null) => {
|
|
|
|
|
+ if (!dateString) return;
|
|
|
const date = moment(dateString);
|
|
const date = moment(dateString);
|
|
|
const formattedDate = date.format('MMM DD');
|
|
const formattedDate = date.format('MMM DD');
|
|
|
const year = date.format('YYYY');
|
|
const year = date.format('YYYY');
|
|
@@ -50,10 +51,16 @@ const TripItem = ({ item, isNew }: { item: TripsData; isNew?: boolean }) => {
|
|
|
) : null}
|
|
) : null}
|
|
|
<View style={styles.tripHeaderContainer}>
|
|
<View style={styles.tripHeaderContainer}>
|
|
|
<View style={styles.tripDateContainer}>
|
|
<View style={styles.tripDateContainer}>
|
|
|
- <CalendarIcon fill={Colors.DARK_BLUE} />
|
|
|
|
|
- <Text style={[styles.tripDateText, { marginLeft: 8 }]}>{formatDate(item.date_from)}</Text>
|
|
|
|
|
- <Text style={styles.tripDateText}>-</Text>
|
|
|
|
|
- <Text style={styles.tripDateText}>{formatDate(item.date_to)}</Text>
|
|
|
|
|
|
|
+ {item.date_from || item.date_to ? (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <CalendarIcon fill={Colors.DARK_BLUE} />
|
|
|
|
|
+ <Text style={[styles.tripDateText, { marginLeft: 8 }]}>
|
|
|
|
|
+ {formatDate(item.date_from)}
|
|
|
|
|
+ </Text>
|
|
|
|
|
+ <Text style={styles.tripDateText}>-</Text>
|
|
|
|
|
+ <Text style={styles.tripDateText}>{formatDate(item.date_to)}</Text>
|
|
|
|
|
+ </>
|
|
|
|
|
+ ) : null}
|
|
|
</View>
|
|
</View>
|
|
|
<TouchableOpacity
|
|
<TouchableOpacity
|
|
|
style={styles.editButton}
|
|
style={styles.editButton}
|