Skip to content

Commit

Permalink
Update util and fix date
Browse files Browse the repository at this point in the history
  • Loading branch information
bombassaro committed Aug 11, 2020
1 parent 08c206c commit 71848c4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 16 deletions.
4 changes: 2 additions & 2 deletions components/utils/dates.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {distanceInWords} from 'date-fns'
import {formatDistance} from 'date-fns'
import {pt} from 'date-fns/locale'
import {map} from 'lodash'

Expand All @@ -7,7 +7,7 @@ const convertDateFromPtBrToDistance = (date) => {
const b = a[2] ? a[2].split(" ") : ``
const c = b[1] ? b[1].split(":") : ``
const new_date = new Date(b[0], a[1], a[0], c[0], c[1])
const distanteInWords = distanceInWords(new_date, new Date(), {locale: pt})
const distanteInWords = formatDistance(new_date, new Date(), {locale: pt})
const replaces = [
["less than a minute", "menos de 1 minuto"],
["about", ""],
Expand Down
12 changes: 0 additions & 12 deletions stories/Icons.stories.js

This file was deleted.

2 changes: 1 addition & 1 deletion teasers.js
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ var convertDateFromPtBrToDistance = function convertDateFromPtBrToDistance(date)
var b = a[2] ? a[2].split(" ") : "";
var c = b[1] ? b[1].split(":") : "";
var new_date = new Date(b[0], a[1], a[0], c[0], c[1]);
var distanteInWords = dateFns.distanceInWords(new_date, new Date(), {
var distanteInWords = dateFns.formatDistance(new_date, new Date(), {
locale: locale
});
var replaces = [["less than a minute", "menos de 1 minuto"], ["about", ""], ["almost", ""], ["over", ""], ["hours", "horas"], ["hour", "hora"], ["months", "meses"], ["month", "mês"], ["minutes", "minutos"], ["minute", "minuto"], ["years", "anos"], ["year", "ano"], ["days", "dias"], ["day", "dia"]];
Expand Down
2 changes: 1 addition & 1 deletion templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ var convertDateFromPtBrToDistance = function convertDateFromPtBrToDistance(date)
var b = a[2] ? a[2].split(" ") : "";
var c = b[1] ? b[1].split(":") : "";
var new_date = new Date(b[0], a[1], a[0], c[0], c[1]);
var distanteInWords = dateFns.distanceInWords(new_date, new Date(), {
var distanteInWords = dateFns.formatDistance(new_date, new Date(), {
locale: locale
});
var replaces = [["less than a minute", "menos de 1 minuto"], ["about", ""], ["almost", ""], ["over", ""], ["hours", "horas"], ["hour", "hora"], ["months", "meses"], ["month", "mês"], ["minutes", "minutos"], ["minute", "minuto"], ["years", "anos"], ["year", "ano"], ["days", "dias"], ["day", "dia"]];
Expand Down

0 comments on commit 71848c4

Please sign in to comment.