From 8916fc096dbbe911f9a2df9f99d54cd561bae87a Mon Sep 17 00:00:00 2001 From: jo-elimu <1451036+jo-elimu@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:25:37 +0700 Subject: [PATCH] fix(analytics): use correct timezone when extracting timestamp from csv Resolves #1924 --- .../java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java b/src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java index 9de7f4520..96278034d 100644 --- a/src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java +++ b/src/main/java/ai/elimu/util/csv/CsvAnalyticsExtractionHelper.java @@ -21,6 +21,8 @@ import java.util.Arrays; import java.util.Calendar; import java.util.List; +import java.util.TimeZone; + import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; @@ -137,7 +139,7 @@ public static List extractVideoLearningEvents(File csvFile) VideoLearningEvent videoLearningEvent = new VideoLearningEvent(); long timestampInMillis = Long.valueOf(csvRecord.get("timestamp")); - Calendar timestamp = Calendar.getInstance(); + Calendar timestamp = Calendar.getInstance(TimeZone.getTimeZone("UTC")); timestamp.setTimeInMillis(timestampInMillis); videoLearningEvent.setTimestamp(timestamp);