Changed the way that we define end dates.

This commit is contained in:
2025-07-03 20:53:33 +10:00
parent 168a8806cf
commit bc02b448a4
5 changed files with 67 additions and 4 deletions

View File

@@ -6,6 +6,13 @@ if ( in_array("cmd", array_keys($_GET)) and $_GET["cmd"] == "get" ) {
$ret = getEvents();
} elseif ( $_POST["cmd"] == "put" ) {
$json = base64_decode($_POST["payload"]);
$events = json_decode($json, true);
for ( $i = 0; $i < count($events); $i++ ) {
foreach ( array( "hours", "agenda", "minutes" ) as $field ) {
unset($events[$i][$field]);
}
}
$json = json_encode($events, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT);
file_put_contents("dat/events.json", $json);
$ret = getEvents();
}

View File

@@ -35,7 +35,8 @@ Vue.createApp({
if (now.isSameOrAfter(next7pm)) {
next7pm.add(1, 'day');
}
const twoHoursLater = moment(next7pm).add(2, 'hours');
event.hours = 2.5;
const twoHoursLater = moment(next7pm).add(event.hours, 'hours');
event.start = next7pm.format('YYYY-MM-DDTHH:mm');
event.end = twoHoursLater.format('YYYY-MM-DDTHH:mm');
this.events.unshift(event);
@@ -63,6 +64,9 @@ Vue.createApp({
validateEvents: function() {
var faults = [];
for ( var e in this.events ) {
var start = moment(this.events[e].start);
var end = start.add(this.events[e].hours, 'hours');
this.events[e].end = end.format('YYYY-MM-DDTHH:mm');
for ( var k in this.fields ) {
var value = this.events[e][k];
value = ( value == undefined ? '' : value );
@@ -117,7 +121,7 @@ Vue.createApp({
this.validateEvents();
},
modalCancel: function() {
frm.modal = null;
this.frm.modal = null;
}
},
mounted: function() {

View File

@@ -62,10 +62,14 @@
<input type="text" disabled class="form-control" :value="formatDate(events[frm.e].start)" v-on:keyup="validateEvents">
<button class="btn btn-outline-secondary" type="button" v-on:click="modal('start')">...</button>
</div>
<div class="input-group mb-1">
<span class="input-group-text">Duration</span>
<input type="number" min="0.5" step="0.5" class="form-control" v-model="events[frm.e].hours" v-on:keyup="validateEvents" v-on:change="validateEvents" style="text-align: right;">
<span class="input-group-text">hrs</span>
</div>
<div class="input-group mb-1">
<span class="input-group-text">End</span>
<input type="text" disabled class="form-control" :value="formatDate(events[frm.e].end)" v-on:keyup="validateEvents">
<button class="btn btn-outline-secondary" type="button" v-on:click="modal('end')">...</button>
</div>
<div class="input-group mb-1">
<span class="input-group-text">Location</span>

View File

@@ -1 +1,44 @@
[{"start":"2025-07-24T18:30:00","end":"2025-07-24T21:00:00","title":"July 2025 In Person Catch Up","description":"Monthly In Person Get Together","location":"Chermside Library","coordinates":"-27.38621539644283,153.0351689206467","ctl":"202507241830","agenda":"- 6.30 pm - Welcome\n- 6.35 pm - Agreement on Agenda Items\n- 6.40 pm - Administrivia (if any)\n- 6.45 pm - Presentation 1: James: Git\n- 7.15 pm - Presentation 2: Terry?: Fossil?\n- 7.45 pm - Loose (Discourse) Threads\n"},{"start":"2025-07-08T19:00:00","end":"2025-07-08T21:00:00","title":"July 2025 Online Catch Up","description":"Monthly Online Jitsi Get Together","location":"Jitsi","ctl":"202507081900","agenda":"- 7.30 pm - Welcome\n- 7.35 pm - Agreement on Agenda Items\n- 7.40 pm - Administrivia (if any)\n- 7.45 pm - Presentation 1 - James: Git\n- 8.15 pm - Presentation 2 - Terry?: Fossil?\n- 8.45 pm - Loose (Discourse) Threads\n"},{"start":"2025-06-19T18:30:00","end":"2025-06-19T21:00:00","title":"June 2025 In Person Catch Up","description":"Social get-together. Discussion about large language models and meshtastic experiments. Clumsy attempt at adhering to an agenda and taking minutes.","location":"Chermside Library","coordinates":"-27.38621539644283,153.0351689206467","ctl":"202506191830","minutes":"- Admin\n\t- ToS and Privacy Policy doesn't need to be hosted on the main page. It's already got a publicly accessible presence in Discourse.\n\t- James to formalise agenda procedure\n\t- James to render cal.php on main page\n\t- James to publish \"subscribe\" link for calendar\n- Recap from Last Month\n\t- Hardware Donations for Education\n\t\t- Substation 33, in Kingston or Logan?\n\t\t- Dirk has a carload of stuff to offload\n- Discourse Themes\n\t- LLMs\n\t- Hardware for LLMs\n\t- Tiny11\n- Agenda\n\t- Motioneye\n\t- Meshtastic\n- Next Month\n\t- Location Requests\n"},{"start":"2025-06-10T19:00:00","end":"2025-06-10T21:00:00","title":"June 2025 Online Catch Up","description":"Getting started with meshtastic","location":"Jitsi","ctl":"202506101900"}]
[
{
"coordinates": "-27.38621539644283,153.0351689206467",
"start": "2025-06-15T09:00",
"end": "2025-06-15T11:30",
"title": "Event Title",
"description": "Event Description",
"location": "Event Location"
},
{
"start": "2025-07-24T18:30:00",
"end": "2025-07-24T21:00",
"title": "July 2025 In Person Catch Up",
"description": "Monthly In Person Get Together",
"location": "Chermside Library",
"coordinates": "-27.38621539644283,153.0351689206467",
"ctl": "202507241830"
},
{
"start": "2025-07-08T19:00:00",
"end": "2025-07-08T21:00",
"title": "July 2025 Online Catch Up",
"description": "Monthly Online Jitsi Get Together",
"location": "Jitsi",
"ctl": "202507081900"
},
{
"start": "2025-06-19T18:30:00",
"end": "2025-06-19T21:00",
"title": "June 2025 In Person Catch Up",
"description": "Social get-together. Discussion about large language models and meshtastic experiments. Clumsy attempt at adhering to an agenda and taking minutes.",
"location": "Chermside Library",
"coordinates": "-27.38621539644283,153.0351689206467",
"ctl": "202506191830"
},
{
"start": "2025-06-10T19:00:00",
"end": "2025-06-10T21:00",
"title": "June 2025 Online Catch Up",
"description": "Getting started with meshtastic",
"location": "Jitsi",
"ctl": "202506101900"
}
]

View File

@@ -10,6 +10,11 @@ function getEvents() {
$dt = new DateTime( $entry["start"] );
$ctl = $dt -> format("YmdHi");
$entries[$i]["ctl"] = $ctl;
$start = new DateTime($entries[$i]["start"]);
$end = new DateTime($entries[$i]["end"]);
$delta = $start->diff($end);
$hours = $delta -> days * 24 + $delta -> h + $delta -> i / 60 + $delta -> s / 3600;
$entries[$i]["hours"] = $hours;
$datestamp = $dt -> format("Ymd");
$files = array( "agenda" => sprintf("dat/agenda/%d.md", $datestamp)
, "minutes" => sprintf("dat/minutes/%d.md", $datestamp)