Commit 50e3b252 by Giang Tran

update color calendar

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