|
237 | 237 | @foreach ($views as $view) |
238 | 238 | <tr> |
239 | 239 | <td class="px-6 py-4 whitespace-nowrap"> |
240 | | - {{ $view->created_at->format('d-m-Y H:i:s') }} |
| 240 | + <span class="date-to-format" data-date="{{ $view->created_at }}"> |
| 241 | + {{ $view->created_at }} |
| 242 | + </span> |
241 | 243 | </td> |
242 | 244 | {{-- <td class="px-6 py-4 whitespace-nowrap"> |
243 | 245 | {{ $view->ip_address }} |
|
259 | 261 | <h2 class="text-2xl font-bold text-yellow-500 mb-6">Messaggi ricevuti</h2> |
260 | 262 | @foreach ($messages->sortByDesc('created_at') as $message) |
261 | 263 | <div class="border-b border-gray-600 py-4"> |
262 | | - <p class="text-lg text-gray-200 font-semibold mb-2">Data: <span class="text-yellow-500">{{ $message->created_at }}</span></p> |
| 264 | + <p class="text-lg text-gray-200 font-semibold mb-2">Data: <span class="text-yellow-500 date-to-format" data-date="{{ $message->created_at }}">{{ $message->created_at }}</span></p> |
263 | 265 | <p class="text-lg text-gray-200 font-semibold mb-2">Inviato da: <span class="text-blue-400">{{ $message->email_sender }}</span></p> |
264 | 266 | <p class="text-md text-gray-300 italic">{{ $message->message }}</p> |
265 | 267 | </div> |
|
277 | 279 | <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> |
278 | 280 |
|
279 | 281 | <script> |
| 282 | + function formatDate(dateString) { |
| 283 | + const options = { |
| 284 | + year: 'numeric', |
| 285 | + month: 'long', |
| 286 | + day: 'numeric', |
| 287 | + hour: '2-digit', |
| 288 | + minute: '2-digit', |
| 289 | + hour12: false |
| 290 | + }; |
| 291 | + return new Date(dateString).toLocaleString('it-IT', options); |
| 292 | + } |
| 293 | +
|
| 294 | + // Formatta tutte le date quando il documento è caricato |
| 295 | + document.addEventListener('DOMContentLoaded', function() { |
| 296 | + const dateElements = document.querySelectorAll('.date-to-format'); |
| 297 | + dateElements.forEach(element => { |
| 298 | + const originalDate = element.dataset.date; |
| 299 | + element.textContent = formatDate(originalDate); |
| 300 | + }); |
| 301 | + }); |
| 302 | +
|
280 | 303 | // Funzione per generare date fittizie |
281 | 304 | function generateFakeData() { |
282 | 305 | const now = new Date(); |
|
0 commit comments