mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
using date/time configuration for detail screen
This commit is contained in:
parent
bfca12a170
commit
7330abb8f1
@ -116,7 +116,7 @@ export function useDetails(clear) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
updateState({ connected: Array.from(connected.values()), members: Array.from(members.values()), unknown });
|
updateState({ connected: Array.from(connected.values()), members: Array.from(members.values()), unknown });
|
||||||
}, [card.state, conversation.state]);
|
}, [card.state, conversation.state, profile.state]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const hostId = conversation.state.card?.card.cardId;
|
const hostId = conversation.state.card?.card.cardId;
|
||||||
@ -127,19 +127,35 @@ export function useDetails(clear) {
|
|||||||
const { logo, subject } = getChannelSubjectLogo(hostId, profileGuid, channel, cards, cardImageUrl);
|
const { logo, subject } = getChannelSubjectLogo(hostId, profileGuid, channel, cards, cardImageUrl);
|
||||||
|
|
||||||
let timestamp;
|
let timestamp;
|
||||||
|
const { timeFull, monthLast } = profile.state || {};
|
||||||
const { created, data, dataType } = conversation.state.channel?.detail || {}
|
const { created, data, dataType } = conversation.state.channel?.detail || {}
|
||||||
const date = new Date(created * 1000);
|
const date = new Date(created * 1000);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const offset = now.getTime() - date.getTime();
|
const offset = now.getTime() - date.getTime();
|
||||||
if(offset < 86400000) {
|
if(offset < 86400000) {
|
||||||
|
if (timeFull) {
|
||||||
|
timestamp = moment(date).format('H:mm');
|
||||||
|
}
|
||||||
|
else {
|
||||||
timestamp = moment(date).format('h:mma');
|
timestamp = moment(date).format('h:mma');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (offset < 31449600000) {
|
else if (offset < 31449600000) {
|
||||||
|
if (monthLast) {
|
||||||
|
timestamp = moment(date).format('DD/M');
|
||||||
|
}
|
||||||
|
else {
|
||||||
timestamp = moment(date).format('M/DD');
|
timestamp = moment(date).format('M/DD');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (monthLast) {
|
||||||
|
timestamp = moment(date).format('DD/M/YYYY');
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
timestamp = moment(date).format('M/DD/YYYY');
|
timestamp = moment(date).format('M/DD/YYYY');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let subjectUpdate;
|
let subjectUpdate;
|
||||||
try {
|
try {
|
||||||
@ -154,7 +170,7 @@ export function useDetails(clear) {
|
|||||||
console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
updateState({ hostId, logo, subject, timestamp, subjectUpdate });
|
updateState({ hostId, logo, subject, timestamp, subjectUpdate });
|
||||||
}, [conversation.state]);
|
}, [conversation.state, profile.state]);
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
showEditMembers: () => {
|
showEditMembers: () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user