fix: Add Portugese, Brazil to language options (#2164)
* Add Portugese, Brazil to language options * Upgrade date-fns package Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import distanceInWordsToNow from "date-fns/distance_in_words_to_now";
|
||||
import { formatDistanceToNow } from "date-fns";
|
||||
import invariant from "invariant";
|
||||
import { deburr, sortBy } from "lodash";
|
||||
import { observable } from "mobx";
|
||||
@@ -94,8 +94,11 @@ class DataLoader extends React.Component<Props> {
|
||||
// search for exact internal document
|
||||
const slug = parseDocumentSlug(term);
|
||||
try {
|
||||
const { document } = await this.props.documents.fetch(slug);
|
||||
const time = distanceInWordsToNow(document.updatedAt, {
|
||||
const {
|
||||
document,
|
||||
}: { document: Document } = await this.props.documents.fetch(slug);
|
||||
|
||||
const time = formatDistanceToNow(Date.parse(document.updatedAt), {
|
||||
addSuffix: true,
|
||||
});
|
||||
return [
|
||||
@@ -118,7 +121,7 @@ class DataLoader extends React.Component<Props> {
|
||||
|
||||
return sortBy(
|
||||
results.map((document) => {
|
||||
const time = distanceInWordsToNow(document.updatedAt, {
|
||||
const time = formatDistanceToNow(document.updatedAt, {
|
||||
addSuffix: true,
|
||||
});
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import distanceInWordsToNow from "date-fns/distance_in_words_to_now";
|
||||
import { formatDistanceToNow } from "date-fns";
|
||||
import invariant from "invariant";
|
||||
import { observer } from "mobx-react";
|
||||
import { GlobeIcon, PadlockIcon } from "outline-icons";
|
||||
@@ -118,9 +118,12 @@ function SharePopover({ document, share, sharedParent, onSubmit }: Props) {
|
||||
<>
|
||||
.{" "}
|
||||
{t("The shared link was last accessed {{ timeAgo }}.", {
|
||||
timeAgo: distanceInWordsToNow(share.lastAccessedAt, {
|
||||
addSuffix: true,
|
||||
}),
|
||||
timeAgo: formatDistanceToNow(
|
||||
Date.parse(share.lastAccessedAt),
|
||||
{
|
||||
addSuffix: true,
|
||||
}
|
||||
),
|
||||
})}
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user