saasufy-components 5.7.0 → 5.8.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 (2) hide show
  1. package/package.json +1 -1
  2. package/utils.js +11 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/utils.js CHANGED
@@ -205,6 +205,16 @@ export function computeId(...parts) {
205
205
  return `${idHex.slice(0, 8)}-${idHex.slice(8, 12)}-${third}-${fourth}-${idHex.slice(20, 32)}`;
206
206
  }
207
207
 
208
+ export function toDate(timestamp) {
209
+ let date = new Date(timestamp);
210
+ let year = date.getFullYear();
211
+ let month = date.toLocaleString('default', { month: 'long' });
212
+ let day = date.getDate();
213
+ let hour = date.getHours();
214
+ let minutes = date.getMinutes();
215
+ return `${month} ${day}, ${year} at ${hour}:${minutes.toString().padStart(2, '0')}`;
216
+ }
217
+
208
218
  let templateFormatters = {
209
219
  url: (value) => String(value).toLowerCase().replace(/ /g, '-'),
210
220
  lowerCase: (value) => String(value).toLowerCase(),
@@ -217,15 +227,7 @@ let templateFormatters = {
217
227
  fallback: (...args) => {
218
228
  return args.filter(arg => arg)[0];
219
229
  },
220
- date: (timestamp) => {
221
- let date = new Date(timestamp);
222
- let year = date.getFullYear();
223
- let month = date.toLocaleString('default', { month: 'long' });
224
- let day = date.getDate();
225
- let hour = date.getHours();
226
- let minutes = date.getMinutes();
227
- return `${month} ${day}, ${year} at ${hour}:${minutes.toString().padStart(2, '0')}`;
228
- },
230
+ date: (timestamp) => toDate(timestamp),
229
231
  joinFields: (list, field, sep) => {
230
232
  return list.map(item => item[field]).join(sep);
231
233
  },