Commit 50e3b252 by Giang Tran

update color calendar

parent 7cfd9ca1
...@@ -236,14 +236,18 @@ export const toPriceVnd = (str) => { ...@@ -236,14 +236,18 @@ export const toPriceVnd = (str) => {
export const floatToPriceVnd = (str) => { export const floatToPriceVnd = (str) => {
if (str) { if (str) {
let stringPrice = str.toString().split('.') let stringPrice = str.toString().split('.');
let headStringPrice = `${stringPrice[0].replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,')}` let headStringPrice = `${stringPrice[0].replace(
return stringPrice.length === 1 ? headStringPrice : headStringPrice.concat(`.${stringPrice[1]}`) /(\d)(?=(\d{3})+(?!\d))/g,
'$1,',
)}`;
return stringPrice.length === 1
? headStringPrice
: headStringPrice.concat(`.${stringPrice[1]}`);
} else { } else {
return '' return '';
} }
} };
// cắt chuỗi dạng something... // cắt chuỗi dạng something...
export const ellipsis = (str = '', max = 30) => export const ellipsis = (str = '', max = 30) =>
...@@ -408,6 +412,10 @@ export const convertDate = (date) => { ...@@ -408,6 +412,10 @@ export const convertDate = (date) => {
return time; return time;
}; };
export const getDate = (date) => {
return moment(date).get('date');
};
export const convertTime = (date) => { export const convertTime = (date) => {
const temp = new Date(moment(date, 'DD/MM/YYYY')); const temp = new Date(moment(date, 'DD/MM/YYYY'));
const time = moment(temp).format('YYYY-MM-DD'); const time = moment(temp).format('YYYY-MM-DD');
......
...@@ -69,8 +69,6 @@ const NewFeed = (props) => { ...@@ -69,8 +69,6 @@ const NewFeed = (props) => {
style={{ style={{
flex: 1, flex: 1,
backgroundColor: 'white', backgroundColor: 'white',
paddingLeft: 10,
paddingRight: 20,
paddingTop: 10, paddingTop: 10,
}}> }}>
<FlatList <FlatList
......
...@@ -2,19 +2,50 @@ import React, {Component} from 'react'; ...@@ -2,19 +2,50 @@ import React, {Component} from 'react';
import {View, Text, StyleSheet} from 'react-native'; import {View, Text, StyleSheet} from 'react-native';
import R from '../../../assets/R'; import R from '../../../assets/R';
import Block from '../../../components/Block'; import Block from '../../../components/Block';
import {getFontXD} from '../../../Config/Functions'; import {getFontXD, convertDate} from '../../../Config/Functions';
import {convertDate} from '../../../Config/Functions';
const Item = (props) => { const Item = (props) => {
const {title, date, time, start_date} = props.item; const {title, date, time, start_date} = props.item;
const d = new Date();
return ( return (
<View style={styles.container}> <View
style={[
styles.container,
d.getDate() == convertDate(start_date).slice(0, 2)
? {backgroundColor: '#B4D5FF'}
: {},
]}>
<View style={styles.left}> <View style={styles.left}>
<View style={styles.dot} /> <View
style={[
styles.dot,
d.getDate() == convertDate(start_date).slice(0, 2)
? {backgroundColor: 'red'}
: {},
]}
/>
</View> </View>
<View style={[styles.right, props.index == 0 ? {borderTopWidth: 0} : {}]}> <View style={[styles.right, props.index == 0 ? {borderTopWidth: 0} : {}]}>
<View style={styles.row}> <View style={styles.row}>
<Text style={styles.txtTime}> {convertDate(start_date)}</Text> <Text
<Text style={styles.txtDate}>{start_date.substring(10, 16)}</Text> style={[
styles.txtTime,
d.getDate() == convertDate(start_date).slice(0, 2)
? {color: 'red', fontWeight: '500'}
: {},
]}>
{' '}
{convertDate(start_date)}
</Text>
<Text
style={[
styles.txtDate,
d.getDate() == convertDate(start_date).slice(0, 2)
? {color: 'red', fontWeight: '500'}
: {},
]}>
{start_date.substring(10, 16)}
</Text>
</View> </View>
<Text style={styles.txtTitle}>{title}</Text> <Text style={styles.txtTitle}>{title}</Text>
</View> </View>
...@@ -27,11 +58,12 @@ export default Item; ...@@ -27,11 +58,12 @@ export default Item;
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
flexDirection: 'row', flexDirection: 'row',
marginLeft: 10, paddingLeft: 20,
paddingRight: 20,
}, },
left: { left: {
width: 0.6, width: 1,
backgroundColor: '#CECECE', backgroundColor: '#A7A7A7',
}, },
right: { right: {
marginLeft: 20, marginLeft: 20,
...@@ -62,6 +94,6 @@ const styles = StyleSheet.create({ ...@@ -62,6 +94,6 @@ const styles = StyleSheet.create({
color: R.colors.main, color: R.colors.main,
}, },
txtDate: { txtDate: {
color: '#929292', color: '#A7A7A7',
}, },
}); });
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