improvement: chat and user-list export file name date string
This commit is contained in:
parent
66477dae7a
commit
fd03bd21bc
@ -4,7 +4,7 @@ import { withModalMounter } from '/imports/ui/components/common/modal/service';
|
||||
import _ from 'lodash';
|
||||
import BBBMenu from "/imports/ui/components/common/menu/component";
|
||||
import Button from '/imports/ui/components/common/button/component';
|
||||
|
||||
import { getDateString } from '/imports/utils/string-utils';
|
||||
import { alertScreenReader } from '/imports/utils/dom-utils';
|
||||
|
||||
import ChatService from '../service';
|
||||
@ -76,13 +76,10 @@ class ChatDropdown extends PureComponent {
|
||||
onClick: () => {
|
||||
const link = document.createElement('a');
|
||||
const mimeType = 'text/plain';
|
||||
const date = new Date();
|
||||
const time = `${date.getHours()}-${date.getMinutes()}`;
|
||||
const dateString = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}_${time}`;
|
||||
link.setAttribute('download', `bbb-${meetingName}[public-chat]_${dateString}.txt`);
|
||||
link.setAttribute('download', `bbb-${meetingName}[public-chat]_${getDateString()}.txt`);
|
||||
link.setAttribute(
|
||||
'href',
|
||||
`data: ${mimeType} ;charset=utf-8,`
|
||||
`data: ${mimeType};charset=utf-8,`
|
||||
+ `${encodeURIComponent(ChatService.exportChat(timeWindowsValues, intl))}`,
|
||||
);
|
||||
link.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
|
||||
|
@ -14,6 +14,7 @@ import VideoService from '/imports/ui/components/video-provider/service';
|
||||
import logger from '/imports/startup/client/logger';
|
||||
import WhiteboardService from '/imports/ui/components/whiteboard/service';
|
||||
import { Session } from 'meteor/session';
|
||||
import { getDateString } from '/imports/utils/string-utils';
|
||||
|
||||
const CHAT_CONFIG = Meteor.settings.public.chat;
|
||||
const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id;
|
||||
@ -662,13 +663,10 @@ export const getUserNamesLink = (docTitle, fnSortedLabel, lnSortedLabel) => {
|
||||
const link = document.createElement('a');
|
||||
const meeting = Meetings.findOne({ meetingId: Auth.meetingID },
|
||||
{ fields: { 'meetingProp.name': 1 } });
|
||||
const date = new Date();
|
||||
const time = `${date.getHours()}-${date.getMinutes()}`;
|
||||
const dateString = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}_${time}`;
|
||||
link.setAttribute('download', `bbb-${meeting.meetingProp.name}[users-list]_${dateString}.txt`);
|
||||
link.setAttribute('download', `bbb-${meeting.meetingProp.name}[users-list]_${getDateString()}.txt`);
|
||||
link.setAttribute(
|
||||
'href',
|
||||
`data: ${mimeType} ;charset=utf-16,${encodeURIComponent(namesListsString)}`,
|
||||
`data: ${mimeType};charset=utf-16,${encodeURIComponent(namesListsString)}`,
|
||||
);
|
||||
return link;
|
||||
};
|
||||
|
@ -1,3 +1,20 @@
|
||||
export const capitalizeFirstLetter = (s = '') => s.charAt(0).toUpperCase() + s.slice(1);
|
||||
|
||||
export default { capitalizeFirstLetter };
|
||||
/**
|
||||
* Returns a string in the format 'Year-Month-Day_Hour-Minutes'.
|
||||
* @param {Date} [date] - The Date object.
|
||||
*/
|
||||
export const getDateString = (date = new Date()) => {
|
||||
const hours = date.getHours().toString().padStart(2, 0);
|
||||
const minutes = date.getMinutes().toString().padStart(2, 0);
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, 0);
|
||||
const dayOfMonth = date.getDate().toString().padStart(2, 0);
|
||||
const time = `${hours}-${minutes}`;
|
||||
const dateString = `${date.getFullYear()}-${month}-${dayOfMonth}_${time}`;
|
||||
return dateString;
|
||||
};
|
||||
|
||||
export default {
|
||||
capitalizeFirstLetter,
|
||||
getDateString,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user