First Phase of Luxon migration (#2521)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
"kbar": "^0.1.0-beta.39",
|
"kbar": "^0.1.0-beta.39",
|
||||||
"local-storage-fallback": "^4.1.1",
|
"local-storage-fallback": "^4.1.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"luxon": "^3.1.1",
|
||||||
"mds": "https://github.com/minio/mds.git#v0.0.8",
|
"mds": "https://github.com/minio/mds.git#v0.0.8",
|
||||||
"minio": "^7.0.32",
|
"minio": "^7.0.32",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
@@ -73,6 +74,7 @@
|
|||||||
},
|
},
|
||||||
"proxy": "http://localhost:9090/",
|
"proxy": "http://localhost:9090/",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/luxon": "^3.1.0",
|
||||||
"@types/react-window": "^1.8.5",
|
"@types/react-window": "^1.8.5",
|
||||||
"@types/react-window-infinite-loader": "^1.0.6",
|
"@types/react-window-infinite-loader": "^1.0.6",
|
||||||
"@types/recharts": "^1.8.24",
|
"@types/recharts": "^1.8.24",
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import { useLocation, useNavigate, useParams } from "react-router-dom";
|
|||||||
import { useDropzone } from "react-dropzone";
|
import { useDropzone } from "react-dropzone";
|
||||||
import { Theme } from "@mui/material/styles";
|
import { Theme } from "@mui/material/styles";
|
||||||
import { Button } from "mds";
|
import { Button } from "mds";
|
||||||
|
import { DateTime } from "luxon";
|
||||||
import createStyles from "@mui/styles/createStyles";
|
import createStyles from "@mui/styles/createStyles";
|
||||||
import Grid from "@mui/material/Grid";
|
import Grid from "@mui/material/Grid";
|
||||||
import get from "lodash/get";
|
import get from "lodash/get";
|
||||||
@@ -750,6 +751,12 @@ const ListObjects = () => {
|
|||||||
dispatch(setDownloadRenameModal(null));
|
dispatch(setDownloadRenameModal(null));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let createdTime = DateTime.now();
|
||||||
|
|
||||||
|
if (bucketInfo?.creation_date) {
|
||||||
|
createdTime = DateTime.fromISO(bucketInfo.creation_date);
|
||||||
|
}
|
||||||
|
|
||||||
const multiActionButtons = [
|
const multiActionButtons = [
|
||||||
{
|
{
|
||||||
action: () => {
|
action: () => {
|
||||||
@@ -867,9 +874,13 @@ const ListObjects = () => {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<Grid item xs={12} className={classes.bucketDetails}>
|
<Grid item xs={12} className={classes.bucketDetails}>
|
||||||
<span className={classes.detailsSpacer}>
|
<span className={classes.detailsSpacer}>
|
||||||
Created:
|
Created on:
|
||||||
<strong>
|
<strong>
|
||||||
{new Date(bucketInfo?.creation_date || "").toString()}
|
{bucketInfo?.creation_date
|
||||||
|
? createdTime.toFormat(
|
||||||
|
"ccc, LLL dd yyyy HH:mm:ss (ZZZZ)"
|
||||||
|
)
|
||||||
|
: ""}
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
</span>
|
||||||
<span className={classes.detailsSpacer}>
|
<span className={classes.detailsSpacer}>
|
||||||
|
|||||||
@@ -14,8 +14,7 @@
|
|||||||
// You should have received a copy of the GNU Affero General Public License
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import React from "react";
|
import { DateTime } from "luxon";
|
||||||
import * as reactMoment from "react-moment";
|
|
||||||
import { BucketObjectItem } from "./types";
|
import { BucketObjectItem } from "./types";
|
||||||
import { niceBytes } from "../../../../../../common/utils";
|
import { niceBytes } from "../../../../../../common/utils";
|
||||||
import { displayFileIconName } from "./utils";
|
import { displayFileIconName } from "./utils";
|
||||||
@@ -26,11 +25,20 @@ export const displayParsedDate = (object: BucketObjectItem) => {
|
|||||||
if (object.name.endsWith("/")) {
|
if (object.name.endsWith("/")) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return (
|
|
||||||
<reactMoment.default>
|
const currTime = DateTime.now();
|
||||||
{new Date(object.last_modified).toString()}
|
const objectTime = DateTime.fromISO(object.last_modified);
|
||||||
</reactMoment.default>
|
|
||||||
);
|
const isToday =
|
||||||
|
currTime.hasSame(objectTime, "day") &&
|
||||||
|
currTime.hasSame(objectTime, "month") &&
|
||||||
|
currTime.hasSame(objectTime, "year");
|
||||||
|
|
||||||
|
if (isToday) {
|
||||||
|
return `Today, ${objectTime.toFormat("HH:mm")}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return objectTime.toFormat("ccc, LLL dd yyyy HH:mm (ZZZZ)");
|
||||||
};
|
};
|
||||||
|
|
||||||
export const displayNiceBytes = (object: BucketObjectItem) => {
|
export const displayNiceBytes = (object: BucketObjectItem) => {
|
||||||
|
|||||||
@@ -2367,6 +2367,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe"
|
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe"
|
||||||
integrity sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==
|
integrity sha512-RoZphVtHbxPZizt4IcILciSWiC6dcn+eZ8oX9IWEYfDMcocdd42f7NPI6fQj+6zI8y4E0L7gu2pcZKLGTRaV9Q==
|
||||||
|
|
||||||
|
"@types/luxon@^3.1.0":
|
||||||
|
version "3.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-3.1.0.tgz#b9842d233a06b267fe4117f1c224f20b8a149825"
|
||||||
|
integrity sha512-gCd/HcCgjqSxfMrgtqxCgYk/22NBQfypwFUG7ZAyG/4pqs51WLTcUzVp1hqTbieDYeHS3WoVEh2Yv/2l+7B0Vg==
|
||||||
|
|
||||||
"@types/mime@*":
|
"@types/mime@*":
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10"
|
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10"
|
||||||
@@ -8015,6 +8020,11 @@ lru-cache@^6.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yallist "^4.0.0"
|
yallist "^4.0.0"
|
||||||
|
|
||||||
|
luxon@^3.1.1:
|
||||||
|
version "3.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.1.1.tgz#b492c645b2474fb86f3bd3283213846b99c32c1e"
|
||||||
|
integrity sha512-Ah6DloGmvseB/pX1cAmjbFvyU/pKuwQMQqz7d0yvuDlVYLTs2WeDHQMpC8tGjm1da+BriHROW/OEIT/KfYg6xw==
|
||||||
|
|
||||||
macos-release@^3.0.1:
|
macos-release@^3.0.1:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-3.1.0.tgz#6165bb0736ae567ed6649e36ce6a24d87cbb7aca"
|
resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-3.1.0.tgz#6165bb0736ae567ed6649e36ce6a24d87cbb7aca"
|
||||||
|
|||||||
Reference in New Issue
Block a user