The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-lib/client/lib/formatDate.js

25 lines
831 B

import { Meteor } from 'meteor/meteor';
import moment from 'moment';
export const formatTime = (time) => {
switch (RocketChat.getUserPreference(Meteor.userId(), 'clockMode', false)) {
case 1:
return moment(time).format('h:mm A');
case 2:
return moment(time).format('H:mm');
default:
return moment(time).format(RocketChat.settings.get('Message_TimeFormat'));
}
};
export const formatDateAndTime = (time) => {
switch (RocketChat.getUserPreference(Meteor.userId(), 'clockMode', false)) {
case 1:
return moment(time).format('MMMM D, Y h:mm A');
case 2:
return moment(time).format('MMMM D, Y H:mm');
default:
return moment(time).format(RocketChat.settings.get('Message_TimeAndDateFormat'));
}
};
export const formatDate = (time) => moment(time).format(RocketChat.settings.get('Message_DateFormat'));