mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 21:38:35 +03:00
@@ -1,4 +1,5 @@
|
||||
/* global d3 */
|
||||
import { timeFormat, timeParse } from 'd3'
|
||||
|
||||
/**
|
||||
* Get URI params to start with predefined set of
|
||||
* https://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript
|
||||
@@ -67,14 +68,14 @@ export function parseDate (datetime) {
|
||||
}
|
||||
|
||||
export function formatterWithYear (datetime) {
|
||||
return d3.timeFormat('%d %b %Y, %H:%M')(datetime)
|
||||
return timeFormat('%d %b %Y, %H:%M')(datetime)
|
||||
}
|
||||
|
||||
export function formatter (datetime) {
|
||||
return d3.timeFormat('%d %b, %H:%M')(datetime)
|
||||
return timeFormat('%d %b, %H:%M')(datetime)
|
||||
}
|
||||
|
||||
export const parseTimestamp = ts => d3.timeParse('%Y-%m-%dT%H:%M:%S')(ts)
|
||||
export const parseTimestamp = ts => timeParse('%Y-%m-%dT%H:%M:%S')(ts)
|
||||
|
||||
export function compareTimestamp (a, b) {
|
||||
return (parseTimestamp(a.timestamp) > parseTimestamp(b.timestamp))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* global d3 */
|
||||
import React from 'react'
|
||||
import { connect } from 'react-redux'
|
||||
import * as d3 from 'd3'
|
||||
import * as selectors from '../selectors'
|
||||
import hash from 'object-hash'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* global d3 */
|
||||
import React from 'react'
|
||||
import * as d3 from 'd3'
|
||||
|
||||
class TimelineAxis extends React.Component {
|
||||
constructor () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* global d3 */
|
||||
import React from 'react'
|
||||
import * as d3 from 'd3'
|
||||
|
||||
class TimelineCategories extends React.Component {
|
||||
constructor () {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
/* global d3 */
|
||||
import { timeFormat, timeParse } from 'd3'
|
||||
|
||||
export function parseDateTimes (arrayToParse) {
|
||||
const parsedArray = []
|
||||
|
||||
arrayToParse.forEach(item => {
|
||||
let incomingDateTime = `${item.date}T00:00`
|
||||
if (item.time) incomingDateTime = `${item.date}T${item.time}`
|
||||
const parser = d3.timeParse(process.env.INCOMING_DATETIME_FORMAT)
|
||||
item.timestamp = d3.timeFormat('%Y-%m-%dT%H:%M:%S')(parser(incomingDateTime))
|
||||
const parser = timeParse(process.env.INCOMING_DATETIME_FORMAT)
|
||||
item.timestamp = timeFormat('%Y-%m-%dT%H:%M:%S')(parser(incomingDateTime))
|
||||
|
||||
parsedArray.push(item)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user