@sendbird/uikit-utils 3.1.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/react-native.js +25 -1
- package/lib/commonjs/hooks/react-native.js.map +1 -1
- package/lib/commonjs/sendbird/message.js +28 -0
- package/lib/commonjs/sendbird/message.js.map +1 -1
- package/lib/commonjs/shared/file.js +1 -0
- package/lib/commonjs/shared/file.js.map +1 -1
- package/lib/commonjs/shared/index.js +8 -0
- package/lib/commonjs/shared/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/ui-format/common.js +26 -1
- package/lib/commonjs/ui-format/common.js.map +1 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/react-native.js +24 -1
- package/lib/module/hooks/react-native.js.map +1 -1
- package/lib/module/sendbird/message.js +26 -1
- package/lib/module/sendbird/message.js.map +1 -1
- package/lib/module/shared/file.js +1 -0
- package/lib/module/shared/file.js.map +1 -1
- package/lib/module/shared/index.js +6 -0
- package/lib/module/shared/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/ui-format/common.js +23 -0
- package/lib/module/ui-format/common.js.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +1 -1
- package/lib/typescript/src/hooks/react-native.d.ts +11 -0
- package/lib/typescript/src/sendbird/message.d.ts +9 -1
- package/lib/typescript/src/shared/index.d.ts +2 -0
- package/lib/typescript/src/types.d.ts +1 -1
- package/lib/typescript/src/ui-format/common.d.ts +8 -0
- package/package.json +5 -9
- package/src/hooks/index.ts +2 -2
- package/src/hooks/react-native.ts +24 -1
- package/src/sendbird/message.ts +29 -2
- package/src/shared/file.ts +1 -0
- package/src/shared/index.ts +8 -0
- package/src/types.ts +3 -1
- package/src/ui-format/common.ts +27 -0
package/src/ui-format/common.ts
CHANGED
|
@@ -125,3 +125,30 @@ export const getMessagePreviewTime = (timestamp: number, locale?: Locale) => {
|
|
|
125
125
|
|
|
126
126
|
return format(timestamp, 'yyyy/MM/dd', { locale });
|
|
127
127
|
};
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* milliseconds to 00:00 format
|
|
131
|
+
* */
|
|
132
|
+
export const millsToMMSS = (mills: number) => {
|
|
133
|
+
let seconds = Math.floor(Math.max(0, mills) / 1000);
|
|
134
|
+
const minutes = Math.floor(seconds / 60);
|
|
135
|
+
seconds = seconds % 60;
|
|
136
|
+
|
|
137
|
+
const mm = String(minutes).padStart(2, '0');
|
|
138
|
+
const ss = String(seconds).padStart(2, '0');
|
|
139
|
+
|
|
140
|
+
return `${mm}:${ss}`;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* milliseconds to 0:00 format
|
|
145
|
+
* */
|
|
146
|
+
export const millsToMSS = (mills: number) => {
|
|
147
|
+
let seconds = Math.floor(Math.max(0, mills) / 1000);
|
|
148
|
+
const minutes = Math.floor(seconds / 60);
|
|
149
|
+
seconds = seconds % 60;
|
|
150
|
+
|
|
151
|
+
const ss = String(seconds).padStart(2, '0');
|
|
152
|
+
|
|
153
|
+
return `${minutes}:${ss}`;
|
|
154
|
+
};
|