mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-02 11:15:35 +03:00
add last week logic
This commit is contained in:
parent
4fad20126c
commit
99ca9606b5
@ -1,6 +1,6 @@
|
||||
/* eslint-disable react/jsx-wrap-multilines */
|
||||
import React, { PureComponent } from 'react';
|
||||
import { View, FlatList, ActivityIndicator, RefreshControl, Text, SectionList } from 'react-native';
|
||||
import { View, FlatList, ActivityIndicator, RefreshControl, Text } from 'react-native';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
// Constants
|
||||
@ -13,7 +13,7 @@ import { ListPlaceHolder } from '../../basicUIElements';
|
||||
import { ThemeContainer } from '../../../containers';
|
||||
|
||||
// Utils
|
||||
import { isToday, isYesterday, isThisWeek, isThisMonth } from '../../../utils/time';
|
||||
import { isToday, isYesterday, isThisWeek, isLastWeek, isThisMonth } from '../../../utils/time';
|
||||
|
||||
// Styles
|
||||
import styles from './notificationStyles';
|
||||
@ -109,6 +109,12 @@ class NotificationView extends PureComponent {
|
||||
}),
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({
|
||||
id: 'notification.last_week',
|
||||
}),
|
||||
data: [],
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({
|
||||
id: 'notification.this_month',
|
||||
@ -152,11 +158,15 @@ class NotificationView extends PureComponent {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (isThisMonth(timestamp)) {
|
||||
if (isLastWeek(timestamp)) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return 4;
|
||||
if (isThisMonth(timestamp)) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 5;
|
||||
};
|
||||
|
||||
|
||||
|
@ -128,6 +128,7 @@
|
||||
"recent": "Recent",
|
||||
"yesterday": "Yesterday",
|
||||
"this_week": "This Week",
|
||||
"last_week": "Last Week",
|
||||
"this_month": "This Month",
|
||||
"older_then": "Older Than A Month",
|
||||
"activities": "All",
|
||||
|
@ -93,6 +93,11 @@ export const isThisWeek = (value) => {
|
||||
return day < TODAY.getTime() && day > SEVEN_DAY.getTime();
|
||||
};
|
||||
|
||||
export const isLastWeek = (value) => {
|
||||
const day = new Date(value).getTime();
|
||||
return day < SEVEN_DAY.getTime() && day > 2 * SEVEN_DAY.getTime();
|
||||
};
|
||||
|
||||
export const isThisMonth = (value) => {
|
||||
const day = new Date(value);
|
||||
return TODAY.getMonth() === day.getMonth() && TODAY.getFullYear() === day.getFullYear() ? 1 : 0;
|
||||
|
Loading…
Reference in New Issue
Block a user