@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.
Files changed (38) hide show
  1. package/lib/commonjs/hooks/index.js.map +1 -1
  2. package/lib/commonjs/hooks/react-native.js +25 -1
  3. package/lib/commonjs/hooks/react-native.js.map +1 -1
  4. package/lib/commonjs/sendbird/message.js +28 -0
  5. package/lib/commonjs/sendbird/message.js.map +1 -1
  6. package/lib/commonjs/shared/file.js +1 -0
  7. package/lib/commonjs/shared/file.js.map +1 -1
  8. package/lib/commonjs/shared/index.js +8 -0
  9. package/lib/commonjs/shared/index.js.map +1 -1
  10. package/lib/commonjs/types.js.map +1 -1
  11. package/lib/commonjs/ui-format/common.js +26 -1
  12. package/lib/commonjs/ui-format/common.js.map +1 -1
  13. package/lib/module/hooks/index.js.map +1 -1
  14. package/lib/module/hooks/react-native.js +24 -1
  15. package/lib/module/hooks/react-native.js.map +1 -1
  16. package/lib/module/sendbird/message.js +26 -1
  17. package/lib/module/sendbird/message.js.map +1 -1
  18. package/lib/module/shared/file.js +1 -0
  19. package/lib/module/shared/file.js.map +1 -1
  20. package/lib/module/shared/index.js +6 -0
  21. package/lib/module/shared/index.js.map +1 -1
  22. package/lib/module/types.js.map +1 -1
  23. package/lib/module/ui-format/common.js +23 -0
  24. package/lib/module/ui-format/common.js.map +1 -1
  25. package/lib/typescript/src/hooks/index.d.ts +1 -1
  26. package/lib/typescript/src/hooks/react-native.d.ts +11 -0
  27. package/lib/typescript/src/sendbird/message.d.ts +9 -1
  28. package/lib/typescript/src/shared/index.d.ts +2 -0
  29. package/lib/typescript/src/types.d.ts +1 -1
  30. package/lib/typescript/src/ui-format/common.d.ts +8 -0
  31. package/package.json +5 -9
  32. package/src/hooks/index.ts +2 -2
  33. package/src/hooks/react-native.ts +24 -1
  34. package/src/sendbird/message.ts +29 -2
  35. package/src/shared/file.ts +1 -0
  36. package/src/shared/index.ts +8 -0
  37. package/src/types.ts +3 -1
  38. package/src/ui-format/common.ts +27 -0
@@ -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
+ };