RoyAalekh commited on
Commit
a84323e
·
1 Parent(s): 1490e09

🗓️ Fix date display in Recent Trees - use created_at field

Browse files

- Changed tree.timestamp to tree.created_at to match Supabase schema
- This fixes the 'Invalid Date' display in Recent Trees section
- Date formatting will now work correctly for all trees

The Supabase database returns 'created_at' but frontend was looking for 'timestamp'.

Files changed (1) hide show
  1. static/app.js +1 -1
static/app.js CHANGED
@@ -443,7 +443,7 @@ class TreeTrackApp {
443
  ${tree.scientific_name || tree.common_name || tree.local_name || 'Unnamed'}
444
  <br> ${tree.latitude.toFixed(4)}, ${tree.longitude.toFixed(4)}
445
  ${tree.tree_code ? '<br> ' + tree.tree_code : ''}
446
- <br> ${new Date(tree.timestamp).toLocaleDateString()}
447
  </div>
448
  </div>
449
  `).join('');
 
443
  ${tree.scientific_name || tree.common_name || tree.local_name || 'Unnamed'}
444
  <br> ${tree.latitude.toFixed(4)}, ${tree.longitude.toFixed(4)}
445
  ${tree.tree_code ? '<br> ' + tree.tree_code : ''}
446
+ <br> ${new Date(tree.created_at).toLocaleDateString()}
447
  </div>
448
  </div>
449
  `).join('');