UNPKG

communication-react-19

Version:

React library for building modern communication user experiences utilizing Azure Communication Services (React 19 compatible fork)

30 lines 1.43 kB
import { MessageThreadStrings } from '../MessageThread'; /** * @private */ export declare const formatTimeForChatMessage: (messageDate: Date) => string; /** * @private */ export declare const formatDateForChatMessage: (messageDate: Date) => string; /** * Given a message date object in ISO8601 and a current date object, generates a user friendly timestamp text * using the system locale. * <time in locale format>. * Yesterday <time in locale format>. * <dateStrings day of week> <time in locale format>. * <date in locale format> <time in locale format>. * * If message is after yesterday, then only show the time. * If message is before yesterday and after day before yesterday, then show 'Yesterday' plus the time. * If message is before day before yesterday and within the current week, then show 'Monday/Tuesday/etc' plus the time. * - We consider start of the week as Sunday. If current day is Sunday, then any time before that is in previous week. * If message is in previous or older weeks, then show date string plus the time. * * @param messageDate - date of message * @param currentDate - date used as offset to create the user friendly timestamp (e.g. to create 'Yesterday' instead of an absolute date) * * @private */ export declare const formatTimestampForChatMessage: (messageDate: Date, todayDate: Date, dateStrings: MessageThreadStrings) => string; //# sourceMappingURL=Datetime.d.ts.map