From 37fb80a2f7a4f45be48962d20e2ef6c53d0b4142 Mon Sep 17 00:00:00 2001
From: Dung Truong
Date: Tue, 1 Jun 2021 10:30:53 -0700
Subject: [PATCH 1/3] add CST, MST, BST, IST converter
---
_includes/head_custom.html | 16 ++++++++++++++++
workshops/EEGLAB_2021_UCSD.md | 4 ++++
2 files changed, 20 insertions(+)
diff --git a/_includes/head_custom.html b/_includes/head_custom.html
index dbb70b7c..1232f8dd 100644
--- a/_includes/head_custom.html
+++ b/_includes/head_custom.html
@@ -54,6 +54,22 @@
validTimezone = "Europe/Amsterdam";
offset = "+02:00";
break;
+ case 'CST':
+ validTimezone = "Asia/Hong_Kong";
+ offset = "+08:00";
+ break;
+ case 'MST':
+ validTimezone = "America/Denver";
+ offset = "-06:00";
+ break;
+ case 'BST':
+ validTimezone = "Europe/London";
+ offset = "+01:00";
+ break;
+ case 'IST':
+ validTimezone = "Asia/Kolkata";
+ offset = "+05:30";
+ break;
}
return [validTimezone, offset];
}
diff --git a/workshops/EEGLAB_2021_UCSD.md b/workshops/EEGLAB_2021_UCSD.md
index 8e558dd8..6e8499c0 100644
--- a/workshops/EEGLAB_2021_UCSD.md
+++ b/workshops/EEGLAB_2021_UCSD.md
@@ -29,6 +29,10 @@ Below is a still-provisional program for the 2021 Virtual EEGLAB Workshop (sugge
+
+
+
+
## MONDAY, June 14th (open to all; free registration required)
From 45a1505d12da5acacdbe2a120c0fe6b5e842c68c Mon Sep 17 00:00:00 2001
From: Dung Truong
Date: Tue, 1 Jun 2021 11:13:44 -0700
Subject: [PATCH 2/3] rename file and convert time into 24-hr format
---
_includes/head.html | 2 +-
_includes/head_custom.html | 76 -------------------------------
_includes/timezone.html | 1 -
_includes/timezone_converter.html | 76 +++++++++++++++++++++++++++++++
4 files changed, 77 insertions(+), 78 deletions(-)
delete mode 100644 _includes/head_custom.html
delete mode 100644 _includes/timezone.html
create mode 100644 _includes/timezone_converter.html
diff --git a/_includes/head.html b/_includes/head.html
index bb3a00de..23002f15 100644
--- a/_includes/head.html
+++ b/_includes/head.html
@@ -33,6 +33,6 @@
{% seo %}
- {% include head_custom.html %}
+ {% include timezone_converter.html %}
diff --git a/_includes/head_custom.html b/_includes/head_custom.html
deleted file mode 100644
index 1232f8dd..00000000
--- a/_includes/head_custom.html
+++ /dev/null
@@ -1,76 +0,0 @@
-
diff --git a/_includes/timezone.html b/_includes/timezone.html
deleted file mode 100644
index ed638e63..00000000
--- a/_includes/timezone.html
+++ /dev/null
@@ -1 +0,0 @@
-1:00am
diff --git a/_includes/timezone_converter.html b/_includes/timezone_converter.html
new file mode 100644
index 00000000..f696ffa9
--- /dev/null
+++ b/_includes/timezone_converter.html
@@ -0,0 +1,76 @@
+
From ed157c14a325fb646b482ef79966dd94bc7ea1e1 Mon Sep 17 00:00:00 2001
From: Dung Truong
Date: Tue, 1 Jun 2021 12:20:57 -0700
Subject: [PATCH 3/3] add mechanism to prepend (next day) if converted time
goes to the next day
---
_includes/timezone_converter.html | 29 ++++++++++++++++++++++++-----
workshops/EEGLAB_2021_UCSD.md | 4 ++--
2 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/_includes/timezone_converter.html b/_includes/timezone_converter.html
index f696ffa9..ce7a023f 100644
--- a/_includes/timezone_converter.html
+++ b/_includes/timezone_converter.html
@@ -9,19 +9,35 @@
}
if (fromTimezone !== toTimezone) {
const timeText = elem.innerHTML;
+ let fromDateText = elem.dataset.date;
+ if (!fromDateText)
+ fromDateText = "2020-04-13";
+ /* conversion */
const [validFromTimezone, utcOffset] = getValidTimezone(fromTimezone);
- const dateTimeString = "2020-04-13T" + reformatTimeString(timeText) + utcOffset;
+ const dateTimeString = reformatTimeString(timeText, fromDateText) + utcOffset;
const [validToTimezone,offset] = getValidTimezone(toTimezone);
const converted = new Date(dateTimeString).toLocaleString("en-GB", {timeZone: validToTimezone});
+ /* check date of converted time and add (next day) string to result if +1 day */
+ const convertedDateOnly = new Date(dateTimeString).toLocaleString("en-GB", {timeZone: validToTimezone, year:'numeric', month:'2-digit', day:'2-digit'});
+ let toDateText = convertedDateOnly.split('/');
+ toDateText = [toDateText[2], toDateText[1], toDateText[0]].join('-');
const newTimeArray = converted.split(" ")[1].split(":");
- const newTime = newTimeArray[0] + ":" + newTimeArray[1];
+ let newTime = newTimeArray[0] + ":" + newTimeArray[1];
+ if (toDateText > fromDateText)
+ newTime += " (next day)";
+ /* set new value */
elem.innerHTML = newTime;
elem.dataset.timezone = toTimezone;
+ elem.dataset.date = toDateText;
}
}
}
- function reformatTimeString(timeString) {
- const re = /(\d?\d:\d\d)(am|pm|AM|PM)?/;
+
+ /*
+ Convert date time string into a format accepted by Date object
+ */
+ function reformatTimeString(timeString, dateString) {
+ const re = /(\d?\d:\d\d)(am|pm|AM|PM)?( \(next day\))?/;
const parsed = timeString.match(re);
if (parsed) {
const hourMinArray = parsed[1].split(":");
@@ -33,7 +49,10 @@
}
}
const hourString = hour.toString().padStart(2, '0');
- return hourString + ":" + hourMinArray[1];
+ if (dateString)
+ return dateString + "T" + hourString + ":" + hourMinArray[1];
+ else
+ return "2020-04-13T" + hourString + ":" + hourMinArray[1];
}
else
return null
diff --git a/workshops/EEGLAB_2021_UCSD.md b/workshops/EEGLAB_2021_UCSD.md
index 6e8499c0..b3b52b0e 100644
--- a/workshops/EEGLAB_2021_UCSD.md
+++ b/workshops/EEGLAB_2021_UCSD.md
@@ -109,7 +109,7 @@ Below is a still-provisional program for the 2021 Virtual EEGLAB Workshop (sugge
## WEDNESDAY, June 16th (paid registration required)
-- 7:00am–7:45 – **ICA decomposition PRACTICUM** (Johanna Wagner)
+- 7:00am–7:45 – **ICA decomposition PRACTICUM** (Johanna Wagner)
- 8:00am–9:00 – **Forward & inverse head modeling** (Zeynep Aakalin Acar)
@@ -137,7 +137,7 @@ Below is a still-provisional program for the 2021 Virtual EEGLAB Workshop (sugge
## THURSDAY, June 17th (paid registration required)
-- 7:00am–7:45 – **ICA clustering PRACTICUM** (Julie Onton)
+- 7:00am–7:45 – **ICA clustering PRACTICUM** (Julie Onton)
- 8:00am-9:00 – **EEGLAB group analysis** (Arnaud Delorme)