Skip to content

Commit

Permalink
move some functions to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangnm committed May 21, 2019
1 parent d75a137 commit 6be237f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import PropTypes from 'prop-types';
import { Text, View } from 'react-native';
import moment from 'moment';

import styles from './Header.styles';
import { getFormattedDate, getCurrentMonth } from '../utils';

import styles from './Header.styles';

const getBorder = (items, index) => {
return {
Expand All @@ -28,14 +29,6 @@ const getColumns = (numberOfDays, selectedDate) => {
return columns;
};

const getFormattedDate = (date, format) => {
return moment(date).format(format);
};

const getCurrentMonth = (date) => {
return moment(date).format('MMMM Y');
};

const getFontSizeHeader = (numberOfDays) => {
if (numberOfDays > 1) {
return 12;
Expand All @@ -51,8 +44,6 @@ const getDayTextStyles = (numberOfDays) => {
};
};

// components

const Column = ({ column, style, numberOfDays, format }) => {
return (
<View style={[styles.column, style]}>
Expand Down
9 changes: 9 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import moment from 'moment';

export const getFormattedDate = (date, format) => {
return moment(date).format(format);
};

export const getCurrentMonth = (date) => {
return moment(date).format('MMMM Y');
};

0 comments on commit 6be237f

Please sign in to comment.