Skip to content
Snippets Groups Projects
Commit 545c3346 authored by tina's avatar tina
Browse files

formats dates

parent 50145491
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ import { ...@@ -3,6 +3,8 @@ import {
Text, View, TouchableOpacity Text, View, TouchableOpacity
} from 'react-native' } from 'react-native'
import Svg,{ G, Rect, Line } from 'react-native-svg' import Svg,{ G, Rect, Line } from 'react-native-svg'
import { LocalDate } from 'js-joda'
import moment from 'moment'
import styles from './styles' import styles from './styles'
import config from '../../config' import config from '../../config'
import { getOrCreateCycleDay } from '../../db' import { getOrCreateCycleDay } from '../../db'
...@@ -87,13 +89,18 @@ export default class DayColumn extends Component { ...@@ -87,13 +89,18 @@ export default class DayColumn extends Component {
} }
const cycleDayNumber = this.getCycleDayNumber(dateString) const cycleDayNumber = this.getCycleDayNumber(dateString)
const shortDate = dateString.split('-').slice(1).join('-') const dayDate = LocalDate.parse(dateString)
const shortDate = dayDate.dayOfMonth() === 1 ?
moment(dateString, "YYYY-MM-DD").format('MMM')
:
moment(dateString, "YYYY-MM-DD").format('Do')
const boldDateLabel = dayDate.dayOfMonth() === 1 ? {fontWeight: 'bold'} : {}
const cycleDayLabel = ( const cycleDayLabel = (
<Text style = {label.number}> <Text style = {label.number}>
{cycleDayNumber ? cycleDayNumber : ' '} {cycleDayNumber ? cycleDayNumber : ' '}
</Text>) </Text>)
const dateLabel = ( const dateLabel = (
<Text style = {label.date}> <Text style = {[label.date, boldDateLabel]}>
{shortDate} {shortDate}
</Text> </Text>
) )
......
...@@ -32,6 +32,7 @@ const styles = { ...@@ -32,6 +32,7 @@ const styles = {
color: 'grey', color: 'grey',
fontSize: 9, fontSize: 9,
fontWeight: '100', fontWeight: '100',
textAlign: 'center',
}, },
number: { number: {
color: primaryColor, color: primaryColor,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment