diff --git a/README.md b/README.md
index 0163060..5922a4e 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,14 @@ HTML inputs are favoring HTML5 ones instead of fancy jquery-like plugins to redu
Other requirements are on the `requirements.txt` file. Install them with `pip` or similar.
+## Data Migrations
+
+Starting with version `v1.0`, there is a `\scripts` folder that will contain any required migrations. They will be listed here in this section to simplify things.
+
+### Migrations
+
+- `data_migration_001`: **`v0.9` -> `v1.0`**. Not backwards compatible once migrated. Must be run before `v1.0` logic or server will throw errors and maybe could override old `due_time` fields.
+
## Docker Environment
- Development strongly encourages using Docker and Docker Compose.
diff --git a/data/sample.json b/data/sample.json
index 1f68a9f..c95ec6b 100644
--- a/data/sample.json
+++ b/data/sample.json
@@ -9,7 +9,7 @@
"title": "Task title",
"id": 0,
"color": "#039BE5",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"is_all_day": true
},
{
@@ -17,7 +17,7 @@
"title": "Task #2",
"id": 1,
"color": "#EF6C00",
- "due_time": "15:30",
+ "start_time": "15:30","end_time": "15:30",
"is_all_day": false
}
]
@@ -32,7 +32,7 @@
"title": "Repetitive weekly weekday",
"id": 0,
"color": "#B19CDA",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"repetition_subtype": "w",
"is_all_day": true
},
@@ -43,7 +43,7 @@
"title": "Repetitive monthly weekday",
"id": 1,
"color": "#53A93F",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"repetition_subtype": "w",
"is_all_day": true
},
@@ -54,7 +54,7 @@
"title": "Repetitive monthly monthday",
"id": 2,
"color": "#777777",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"repetition_subtype": "m",
"is_all_day": true
},
@@ -65,7 +65,7 @@
"title": "Repetitive weekly weekday",
"id": 3,
"color": "#785649",
- "due_time": "19:30",
+ "start_time": "19:30","end_time": "19:30",
"repetition_subtype": "w",
"is_all_day": false
}
diff --git a/data/sample2.json b/data/sample2.json
index 6c590b3..7b4b7aa 100644
--- a/data/sample2.json
+++ b/data/sample2.json
@@ -5,7 +5,7 @@
"repetition_value": 0,
"details": "every monday (all day task)",
"title": "Repetitive weekly weekday",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"color": "#B19CDA",
"repetition_subtype": "w",
"is_all_day": true,
@@ -16,7 +16,7 @@
"repetition_value": 5,
"details": "1st saturday of the month",
"title": "Repetitive monthly weekday",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"color": "#53A93F",
"repetition_subtype": "w",
"is_all_day": true,
@@ -27,7 +27,7 @@
"repetition_value": 1,
"details": "1st day of the month",
"title": "Repetitive monthly monthday",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"color": "#777777",
"repetition_subtype": "m",
"is_all_day": true,
@@ -38,7 +38,7 @@
"repetition_value": 3,
"details": "every thursday at afternoon",
"title": "Repetitive weekly weekday",
- "due_time": "19:30",
+ "start_time": "19:30","end_time": "19:30",
"color": "#785649",
"repetition_subtype": "w",
"is_all_day": false,
@@ -55,7 +55,7 @@
"color": "#53A93F",
"details": " ",
"title": "test 2222",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"id": 1517683764,
"is_all_day": true
}
@@ -69,7 +69,7 @@
"color": "#039BE5",
"details": "Task details",
"title": "Task title",
- "due_time": "00:00",
+ "start_time": "00:00","end_time": "00:00",
"is_all_day": true,
"id": 0
},
@@ -77,7 +77,7 @@
"color": "#EF6C00",
"details": "Task 2 details",
"title": "Task #2",
- "due_time": "15:30",
+ "start_time": "15:30","end_time": "15:30",
"is_all_day": false,
"id": 1
}
diff --git a/flask_calendar/actions.py b/flask_calendar/actions.py
index e897c34..c005047 100644
--- a/flask_calendar/actions.py
+++ b/flask_calendar/actions.py
@@ -237,7 +237,8 @@ def update_task_action(calendar_id: str, year: str, month: str, day: str, task_i
else:
updated_year = updated_month = updated_day = None
is_all_day = request.form.get("is_all_day", "0") == "1"
- due_time = request.form["due_time"]
+ start_time = request.form["start_time"]
+ end_time = request.form.get("end_time", None)
details = request.form["details"].replace("\r", "").replace("\n", "
")
color = request.form["color"]
has_repetition = request.form.get("repeats", "0") == "1"
@@ -252,7 +253,8 @@ def update_task_action(calendar_id: str, year: str, month: str, day: str, task_i
day=updated_day,
title=title,
is_all_day=is_all_day,
- due_time=due_time,
+ start_time=start_time,
+ end_time=end_time,
details=details,
color=color,
has_repetition=has_repetition,
@@ -287,7 +289,8 @@ def save_task_action(calendar_id: str) -> Response:
else:
year = month = day = None
is_all_day = request.form.get("is_all_day", "0") == "1"
- due_time = request.form["due_time"]
+ start_time = request.form["start_time"]
+ end_time = request.form.get("end_time", None)
details = request.form["details"].replace("\r", "").replace("\n", "
")
color = request.form["color"]
has_repetition = request.form.get("repeats", "0") == "1"
@@ -303,7 +306,8 @@ def save_task_action(calendar_id: str) -> Response:
day=day,
title=title,
is_all_day=is_all_day,
- due_time=due_time,
+ start_time=start_time,
+ end_time=end_time,
details=details,
color=color,
has_repetition=has_repetition,
diff --git a/flask_calendar/calendar_data.py b/flask_calendar/calendar_data.py
index 5616dd0..6a33ee5 100644
--- a/flask_calendar/calendar_data.py
+++ b/flask_calendar/calendar_data.py
@@ -200,13 +200,14 @@ def create_task(
day: Optional[int],
title: str,
is_all_day: bool,
- due_time: str,
+ start_time: str,
details: str,
color: str,
has_repetition: bool,
repetition_type: Optional[str],
repetition_subtype: Optional[str],
repetition_value: int,
+ end_time: Optional[str] = None,
) -> bool:
details = details if len(details) > 0 else " "
data = self.load_calendar(calendar_id)
@@ -214,7 +215,8 @@ def create_task(
new_task = {
"id": int(time.time()),
"color": color,
- "due_time": due_time,
+ "start_time": start_time,
+ "end_time": end_time if end_time else start_time,
"is_all_day": is_all_day,
"title": title,
"details": details,
diff --git a/flask_calendar/scripts/data_migration_001.sh b/flask_calendar/scripts/data_migration_001.sh
new file mode 100755
index 0000000..5ef8b40
--- /dev/null
+++ b/flask_calendar/scripts/data_migration_001.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+if [[ $# -eq 0 ]] ; then
+ echo 'Must pass as an argument the data folder'
+ exit 0
+fi
+DATA_FOLDER=$1
+
+find $DATA_FOLDER -name '*.json' -type f -exec sed -i 's/"due_time":\(\s\?"[0-9]\{1,2\}:[0-9]\{1,2\}"\)/"start_time":\1,"end_time":\1/g' {} \;
+
+echo 'Migration of json data complete. Data files are not backwards compatible with versions previous to v1.0.'
diff --git a/flask_calendar/static/style.css b/flask_calendar/static/style.css
index 1272d61..868cdc9 100644
--- a/flask_calendar/static/style.css
+++ b/flask_calendar/static/style.css
@@ -168,6 +168,10 @@ li {
cursor: auto;
}
+span.time {
+ font-size: 9px;
+}
+
span.daynumber {
font-size: 13.5px;
font-weight: 400;
diff --git a/flask_calendar/templates/calendar.html b/flask_calendar/templates/calendar.html
index 0ad2662..37ca55c 100644
--- a/flask_calendar/templates/calendar.html
+++ b/flask_calendar/templates/calendar.html
@@ -57,7 +57,7 @@
{{ day.day }}
@@ -324,7 +324,8 @@
return;
}
if (eventData.target.nodeName === "LI" && eventData.target.className === "task") {
- ToggleDetails(eventData.target.children[0]);
+ // If is not "all day" there will be a span containing the time before the content
+ ToggleDetails(eventData.target.children[eventData.target.children.length - 1]);
return;
}
if (eventData.target.nodeName === "P" && (eventData.target.className === "accordion-hidden" ||
diff --git a/flask_calendar/templates/task.html b/flask_calendar/templates/task.html
index 285ca24..c187fcf 100644
--- a/flask_calendar/templates/task.html
+++ b/flask_calendar/templates/task.html
@@ -41,13 +41,16 @@
/>
-