research: Add date time

This commit is contained in:
Fam Zheng 2025-03-02 10:16:20 +00:00
parent 004a0174dd
commit 690f500ba6
2 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@
<input type="checkbox" v-model="selectedDatapoints[datapoint.path]">
<router-link target="_blank" :to="`/datapoint/${folder}/${datapoint.basename}`" @click.prevent="showModal(datapoint)">
<img :title="datapoint_title(datapoint)" class="datapoint-image" :src="datapoint.image_data_url">
<span class="datapoint-datetime">{{ datapoint.datetime }}</span>
</router-link>
</div>
</div>

View File

@ -78,8 +78,12 @@ def load_datapoint(path):
with open(path, 'rb') as f:
data = json.load(f)
data["path"] = path
data["datetime"] = get_file_datetime(path)
return data
def get_file_datetime(path):
return datetime.fromtimestamp(os.path.getmtime(path))
@app.route('/api/image')
def image():
folder = request.args.get('folder')