File tree 3 files changed +25
-2
lines changed
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " osmcha-frontend" ,
3
- "version" : " 0.58.1 " ,
3
+ "version" : " 0.58.2 " ,
4
4
"license" : " ISC" ,
5
5
"engines" : {
6
6
"node" : " >=7.0"
Original file line number Diff line number Diff line change @@ -19,4 +19,9 @@ export const whosThat =
19
19
20
20
export const nominatimUrl = 'https://nominatim.openstreetmap.org/search.php' ;
21
21
22
+ // set a default from date x days before today
22
23
export const DEFAULT_FROM_DATE = 7 ;
24
+ // exclude changesets newer than x minutes. It's needed because of the difference
25
+ // between the time a changeset is processed by OSMCha and the time its map
26
+ // visualization is available
27
+ export const DEFAULT_TO_DATE = 5 ;
Original file line number Diff line number Diff line change 2
2
import { List , Map , fromJS } from 'immutable' ;
3
3
import moment from 'moment' ;
4
4
5
- import { DEFAULT_FROM_DATE } from '../config/constants' ;
5
+ import { DEFAULT_FROM_DATE , DEFAULT_TO_DATE } from '../config/constants' ;
6
6
import type { filtersType } from '../components/filters' ;
7
7
8
8
export function validateFilters ( filters : filtersType ) : boolean {
@@ -47,9 +47,27 @@ export function getDefaultFromDate(): filtersType {
47
47
} ) ;
48
48
}
49
49
50
+ export function getDefaultToDate ( ) : filtersType {
51
+ const defaultDate = moment ( )
52
+ . subtract ( DEFAULT_TO_DATE , 'minutes' )
53
+ . utc ( )
54
+ . format ( 'YYYY-MM-DD HH:mm' ) ;
55
+ return fromJS ( {
56
+ date__lte : [
57
+ {
58
+ label : '' ,
59
+ value : defaultDate
60
+ }
61
+ ]
62
+ } ) ;
63
+ }
64
+
50
65
export function appendDefaultDate ( filters : filtersType ) {
51
66
if ( filters && ! filters . has ( 'date__gte' ) && ! filters . has ( 'date__lte' ) ) {
52
67
filters = filters . merge ( getDefaultFromDate ( ) ) ;
53
68
}
69
+ if ( filters && ! filters . has ( 'date__lte' ) ) {
70
+ filters = filters . merge ( getDefaultToDate ( ) ) ;
71
+ }
54
72
return filters ;
55
73
}
You can’t perform that action at this time.
0 commit comments