mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 05:18:34 +03:00
Clean store fields, move from state.ui to state.app those that make sense
This commit is contained in:
@@ -5,15 +5,16 @@
|
||||
TODO: is it possible to express this idiomatically as React?
|
||||
*/
|
||||
import {
|
||||
areEqual
|
||||
areEqual,
|
||||
parseDate,
|
||||
formatterWithYear
|
||||
} from '../utilities';
|
||||
import esLocale from '../data/es-MX.json';
|
||||
import copy from '../data/copy.json';
|
||||
|
||||
export default function(app, ui, methods) {
|
||||
d3.timeFormatDefaultLocale(esLocale);
|
||||
const formatterWithYear = ui.tools.formatterWithYear;
|
||||
const parser = ui.tools.parser;
|
||||
|
||||
const zoomLevels = app.zoomLevels;
|
||||
let events = [];
|
||||
let categories = [];
|
||||
@@ -242,7 +243,7 @@ export default function(app, ui, methods) {
|
||||
* @param {object} eventPoint: regular eventPoint data
|
||||
*/
|
||||
function getEventX(eventPoint) {
|
||||
return scale.x(parser(eventPoint.timestamp));
|
||||
return scale.x(parseDate(eventPoint.timestamp));
|
||||
}
|
||||
|
||||
function getTimeScaleExtent() {
|
||||
|
||||
@@ -49,3 +49,11 @@ export function parseDate(datetime) {
|
||||
datetime.slice(17, 19)
|
||||
);
|
||||
}
|
||||
|
||||
export function formatterWithYear(datetime) {
|
||||
return d3.timeFormat("%d %b %Y, %H:%M")(datetime);
|
||||
}
|
||||
|
||||
export function formatter(datetime) {
|
||||
return d3.timeFormat("%d %b, %H:%M")(datetime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user