Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update frontend/src/main.jsx
Browse files- frontend/src/main.jsx +59 -44
frontend/src/main.jsx
CHANGED
|
@@ -1,44 +1,59 @@
|
|
| 1 |
-
|
| 2 |
-
import {
|
| 3 |
-
import
|
| 4 |
-
import './
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
};
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
};
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { StrictMode } from 'react'
|
| 2 |
+
import { createRoot } from 'react-dom/client'
|
| 3 |
+
import './index.css'
|
| 4 |
+
import App from './App.jsx'
|
| 5 |
+
|
| 6 |
+
// Safe Global Date Format Overrides
|
| 7 |
+
const originalToLocaleDateString = Date.prototype.toLocaleDateString;
|
| 8 |
+
|
| 9 |
+
Date.prototype.toLocaleDateString = function(...args) {
|
| 10 |
+
if (isNaN(this.getTime())) return 'N/A';
|
| 11 |
+
try {
|
| 12 |
+
const day = this.getDate();
|
| 13 |
+
const month = originalToLocaleDateString.call(this, 'en-US', { month: 'short' }).toUpperCase();
|
| 14 |
+
const year = this.getFullYear();
|
| 15 |
+
return `${day}-${month}-${year}`;
|
| 16 |
+
} catch {
|
| 17 |
+
return 'N/A';
|
| 18 |
+
}
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
+
Date.prototype.toLocaleString = function(...args) {
|
| 22 |
+
if (isNaN(this.getTime())) return 'N/A';
|
| 23 |
+
try {
|
| 24 |
+
const day = this.getDate();
|
| 25 |
+
const month = originalToLocaleDateString.call(this, 'en-US', { month: 'short' }).toUpperCase();
|
| 26 |
+
const year = this.getFullYear();
|
| 27 |
+
|
| 28 |
+
let hours = this.getHours();
|
| 29 |
+
const minutes = this.getMinutes().toString().padStart(2, '0');
|
| 30 |
+
const ampm = hours >= 12 ? 'PM' : 'AM';
|
| 31 |
+
hours = hours % 12;
|
| 32 |
+
hours = hours ? hours : 12;
|
| 33 |
+
const strTime = `${hours.toString().padStart(2, '0')}:${minutes} ${ampm}`;
|
| 34 |
+
|
| 35 |
+
return `${day}-${month}-${year} ${strTime}`;
|
| 36 |
+
} catch {
|
| 37 |
+
return 'N/A';
|
| 38 |
+
}
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
Date.prototype.toLocaleTimeString = function(...args) {
|
| 42 |
+
if (isNaN(this.getTime())) return 'N/A';
|
| 43 |
+
try {
|
| 44 |
+
let hours = this.getHours();
|
| 45 |
+
const minutes = this.getMinutes().toString().padStart(2, '0');
|
| 46 |
+
const ampm = hours >= 12 ? 'PM' : 'AM';
|
| 47 |
+
hours = hours % 12;
|
| 48 |
+
hours = hours ? hours : 12;
|
| 49 |
+
return `${hours.toString().padStart(2, '0')}:${minutes} ${ampm}`;
|
| 50 |
+
} catch {
|
| 51 |
+
return 'N/A';
|
| 52 |
+
}
|
| 53 |
+
};
|
| 54 |
+
|
| 55 |
+
createRoot(document.getElementById('root')).render(
|
| 56 |
+
<StrictMode>
|
| 57 |
+
<App />
|
| 58 |
+
</StrictMode>,
|
| 59 |
+
)
|