@makolabs/ripple 0.0.1-dev.62 → 0.0.1-dev.63

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.
@@ -2,7 +2,6 @@
2
2
  import { onMount } from 'svelte';
3
3
  import { Button, Table, Color, Size } from '../index.js';
4
4
  import type { TableColumn } from '../index.js';
5
- import { formatDate } from '../utils/dateUtils.js';
6
5
  import type {
7
6
  StorageAdapter,
8
7
  FileItem,
@@ -58,6 +57,31 @@
58
57
  return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
59
58
  }
60
59
 
60
+ // Format a date to a specific format
61
+ function formatDate(date: Date | string | number, formatStr = 'DD.MM.YYYY HH:mm'): string {
62
+ const d = new Date(date);
63
+
64
+ if (isNaN(d.getTime())) {
65
+ return 'Invalid Date';
66
+ }
67
+
68
+ // Simple format implementation for common patterns
69
+ const day = d.getDate().toString().padStart(2, '0');
70
+ const month = (d.getMonth() + 1).toString().padStart(2, '0');
71
+ const year = d.getFullYear();
72
+ const hours = d.getHours().toString().padStart(2, '0');
73
+ const minutes = d.getMinutes().toString().padStart(2, '0');
74
+ const seconds = d.getSeconds().toString().padStart(2, '0');
75
+
76
+ return formatStr
77
+ .replace('DD', day)
78
+ .replace('MM', month)
79
+ .replace('YYYY', year.toString())
80
+ .replace('HH', hours)
81
+ .replace('mm', minutes)
82
+ .replace('ss', seconds);
83
+ }
84
+
61
85
  // Function that determines if a batch action should be shown
62
86
  function isBatchActionAllowed(action: FileAction): action is FileActionBatch {
63
87
  if (isFetchingRecursively) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makolabs/ripple",
3
- "version": "0.0.1-dev.62",
3
+ "version": "0.0.1-dev.63",
4
4
  "description": "Simple Svelte 5 powered component library ✨",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +0,0 @@
1
- /**
2
- * Format a date to a specific format
3
- * @param date - Date to format
4
- * @param format - Format string (default: 'YYYY-MM-DD')
5
- * @returns Formatted date string
6
- */
7
- export declare function formatDate(date: Date | string | number, formatStr?: string): string;
@@ -1,26 +0,0 @@
1
- /**
2
- * Format a date to a specific format
3
- * @param date - Date to format
4
- * @param format - Format string (default: 'YYYY-MM-DD')
5
- * @returns Formatted date string
6
- */
7
- export function formatDate(date, formatStr = 'DD.MM.YYYY HH:mm') {
8
- const d = new Date(date);
9
- if (isNaN(d.getTime())) {
10
- return 'Invalid Date';
11
- }
12
- // Simple format implementation for common patterns
13
- const day = d.getDate().toString().padStart(2, '0');
14
- const month = (d.getMonth() + 1).toString().padStart(2, '0');
15
- const year = d.getFullYear();
16
- const hours = d.getHours().toString().padStart(2, '0');
17
- const minutes = d.getMinutes().toString().padStart(2, '0');
18
- const seconds = d.getSeconds().toString().padStart(2, '0');
19
- return formatStr
20
- .replace('DD', day)
21
- .replace('MM', month)
22
- .replace('YYYY', year.toString())
23
- .replace('HH', hours)
24
- .replace('mm', minutes)
25
- .replace('ss', seconds);
26
- }