Feat: Use moment js to manage dates
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import moment from 'moment'
|
||||
export function appendTag (row, keywords, field = 'Libellé') {
|
||||
// Append row.tag
|
||||
// if row.libellé contains one of words and not invert it gets tagged
|
||||
@@ -25,6 +26,10 @@ function strContains (string, words, invert) {
|
||||
}
|
||||
}
|
||||
|
||||
export function formatDate (row, field = 'Date') {
|
||||
row[field] = moment(row[field], 'DD/MM/YYYY', true)
|
||||
}
|
||||
|
||||
export function total (row, field = 'Montant') {
|
||||
var sum = row.map(x => parseFloat(x[field]))
|
||||
.reduce((sum, x) => sum + x, 0)
|
||||
|
||||
Reference in New Issue
Block a user