Merge branch 'main' into file-info-redesign
This commit is contained in:
commit
48cd1b375a
|
@ -21,6 +21,7 @@ import { FlexWrapper } from './Container';
|
||||||
import { Typography } from '@mui/material';
|
import { Typography } from '@mui/material';
|
||||||
import { GalleryContext } from 'pages/gallery';
|
import { GalleryContext } from 'pages/gallery';
|
||||||
import { SpecialPadding } from 'styles/SpecialPadding';
|
import { SpecialPadding } from 'styles/SpecialPadding';
|
||||||
|
import { formatDate } from 'utils/time/format';
|
||||||
|
|
||||||
const A_DAY = 24 * 60 * 60 * 1000;
|
const A_DAY = 24 * 60 * 60 * 1000;
|
||||||
const FOOTER_HEIGHT = 90;
|
const FOOTER_HEIGHT = 90;
|
||||||
|
@ -304,22 +305,17 @@ export function PhotoList({
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
currentDate = item.metadata.creationTime / 1000;
|
currentDate = item.metadata.creationTime / 1000;
|
||||||
const dateTimeFormat = new Intl.DateTimeFormat('en-IN', {
|
|
||||||
weekday: 'short',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
timeStampList.push({
|
timeStampList.push({
|
||||||
itemType: ITEM_TYPE.TIME,
|
itemType: ITEM_TYPE.TIME,
|
||||||
date: isSameDay(new Date(currentDate), new Date())
|
date: isSameDay(new Date(currentDate), new Date())
|
||||||
? 'Today'
|
? constants.TODAY
|
||||||
: isSameDay(
|
: isSameDay(
|
||||||
new Date(currentDate),
|
new Date(currentDate),
|
||||||
new Date(Date.now() - A_DAY)
|
new Date(Date.now() - A_DAY)
|
||||||
)
|
)
|
||||||
? 'Yesterday'
|
? constants.YESTERDAY
|
||||||
: dateTimeFormat.format(currentDate),
|
: formatDate(currentDate),
|
||||||
id: currentDate.toString(),
|
id: currentDate.toString(),
|
||||||
});
|
});
|
||||||
timeStampList.push({
|
timeStampList.push({
|
||||||
|
|
|
@ -59,9 +59,15 @@ export default function Recover() {
|
||||||
setFieldError
|
setFieldError
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
|
recoveryKey = recoveryKey
|
||||||
|
.trim()
|
||||||
|
.split(' ')
|
||||||
|
.map((part) => part.trim())
|
||||||
|
.filter((part) => !!part)
|
||||||
|
.join(' ');
|
||||||
// check if user is entering mnemonic recovery key
|
// check if user is entering mnemonic recovery key
|
||||||
if (recoveryKey.trim().indexOf(' ') > 0) {
|
if (recoveryKey.indexOf(' ') > 0) {
|
||||||
if (recoveryKey.trim().split(' ').length !== 24) {
|
if (recoveryKey.split(' ').length !== 24) {
|
||||||
throw new Error('recovery code should have 24 words');
|
throw new Error('recovery code should have 24 words');
|
||||||
}
|
}
|
||||||
recoveryKey = bip39.mnemonicToEntropy(recoveryKey);
|
recoveryKey = bip39.mnemonicToEntropy(recoveryKey);
|
||||||
|
|
|
@ -52,9 +52,15 @@ export default function Recover() {
|
||||||
setFieldError
|
setFieldError
|
||||||
) => {
|
) => {
|
||||||
try {
|
try {
|
||||||
|
recoveryKey = recoveryKey
|
||||||
|
.trim()
|
||||||
|
.split(' ')
|
||||||
|
.map((part) => part.trim())
|
||||||
|
.filter((part) => !!part)
|
||||||
|
.join(' ');
|
||||||
// check if user is entering mnemonic recovery key
|
// check if user is entering mnemonic recovery key
|
||||||
if (recoveryKey.trim().indexOf(' ') > 0) {
|
if (recoveryKey.indexOf(' ') > 0) {
|
||||||
if (recoveryKey.trim().split(' ').length !== 24) {
|
if (recoveryKey.split(' ').length !== 24) {
|
||||||
throw new Error('recovery code should have 24 words');
|
throw new Error('recovery code should have 24 words');
|
||||||
}
|
}
|
||||||
recoveryKey = bip39.mnemonicToEntropy(recoveryKey);
|
recoveryKey = bip39.mnemonicToEntropy(recoveryKey);
|
||||||
|
|
|
@ -835,6 +835,9 @@ const englishConstants = {
|
||||||
'A new version of ente has been released, but it cannot be automatically downloaded and installed.',
|
'A new version of ente has been released, but it cannot be automatically downloaded and installed.',
|
||||||
DOWNLOAD_AND_INSTALL: 'Download and install',
|
DOWNLOAD_AND_INSTALL: 'Download and install',
|
||||||
IGNORE_THIS_VERSION: 'Ignore this version',
|
IGNORE_THIS_VERSION: 'Ignore this version',
|
||||||
|
TODAY: 'Today',
|
||||||
|
YESTERDAY: 'Yesterday',
|
||||||
|
AT: 'at',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default englishConstants;
|
export default englishConstants;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import constants from 'utils/strings/constants';
|
||||||
|
|
||||||
export function formatDateFull(date: number | Date) {
|
export function formatDateFull(date: number | Date) {
|
||||||
const dateTimeFormat1 = new Intl.DateTimeFormat('en-US', {
|
const dateTimeFormat1 = new Intl.DateTimeFormat('en-US', {
|
||||||
weekday: 'short',
|
weekday: 'short',
|
||||||
|
@ -33,6 +35,18 @@ export function formatDate(date: number | Date) {
|
||||||
.join(' ');
|
.join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatDateTimeShort(date: number | Date) {
|
||||||
|
const dateTimeFormat = new Intl.DateTimeFormat('en-US', {
|
||||||
|
month: 'short',
|
||||||
|
day: 'numeric',
|
||||||
|
year: 'numeric',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
});
|
||||||
|
|
||||||
|
return dateTimeFormat.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
export function formatTime(date: number | Date) {
|
export function formatTime(date: number | Date) {
|
||||||
const timeFormat = new Intl.DateTimeFormat('en-IN', {
|
const timeFormat = new Intl.DateTimeFormat('en-IN', {
|
||||||
timeStyle: 'short',
|
timeStyle: 'short',
|
||||||
|
@ -41,24 +55,13 @@ export function formatTime(date: number | Date) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDateTimeFull(dateTime: number | Date): string {
|
export function formatDateTimeFull(dateTime: number | Date): string {
|
||||||
return [formatDateFull(dateTime), 'at', formatTime(dateTime)].join(' ');
|
return [formatDateFull(dateTime), constants.AT, formatTime(dateTime)].join(
|
||||||
|
' '
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDateTime(dateTime: number | Date): string {
|
export function formatDateTime(dateTime: number | Date): string {
|
||||||
return [formatDate(dateTime), 'at', formatTime(dateTime)].join(' ');
|
return [formatDate(dateTime), constants.AT, formatTime(dateTime)].join(' ');
|
||||||
}
|
|
||||||
|
|
||||||
export function formatDateTimeShort(date: number | Date) {
|
|
||||||
const dateTimeFormat = new Intl.DateTimeFormat('en-IN', {
|
|
||||||
weekday: 'short',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'short',
|
|
||||||
day: 'numeric',
|
|
||||||
});
|
|
||||||
const timeFormat = new Intl.DateTimeFormat('en-IN', {
|
|
||||||
timeStyle: 'short',
|
|
||||||
});
|
|
||||||
return `${dateTimeFormat.format(date)} ${timeFormat.format(date)}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function formatDateRelative(date: number) {
|
export function formatDateRelative(date: number) {
|
||||||
|
|
Loading…
Reference in a new issue