Repository: blairconrad/dicognito

Issue:
Fails to anonymize TimeOfLastCalibration
because we expect to find "Date" and "Time" at the _end_ of the element name.

Discussion:

Patch:
diff --git a/src/dicognito/datetimeanonymizer.py b/src/dicognito/datetimeanonymizer.py
index ba7ad8e..14ccade 100644
--- a/src/dicognito/datetimeanonymizer.py
+++ b/src/dicognito/datetimeanonymizer.py
@@ -53,7 +53,11 @@ class DateTimeAnonymizer:
             dates = [data_element.value]
 
         times = []
-        time_name = data_element.keyword[:-4] + "Time"
+        if data_element.keyword.endswith("Date"):
+            time_name = data_element.keyword[:-4] + "Time"
+        elif data_element.keyword.startswith("Date"):
+            time_name = "Time" + data_element.keyword[4:]
+
         if time_name in dataset:
             time_value = dataset.data_element(time_name).value
             if time_value:
diff --git a/src/dicognito/release_notes.md b/src/dicognito/release_notes.md
index 2e4d91d..b894047 100644
--- a/src/dicognito/release_notes.md
+++ b/src/dicognito/release_notes.md
@@ -1,5 +1,9 @@
-## 0.8.0
-
+### Fixed
+
+- Fails to anonymize TimeOfLastCalibration ([#66](https://github.com/blairconrad/dicognito/issues/66))
+
+## 0.8.0
+
 ### Changed
 
 - Drop support for Python 2.7 ([#63](https://github.com/blairconrad/dicognito/issues/63))


Test patch:
diff --git a/tests/test_anonymize_single_instance.py b/tests/test_anonymize_single_instance.py
index 74b7aef..567e996 100644
--- a/tests/test_anonymize_single_instance.py
+++ b/tests/test_anonymize_single_instance.py
@@ -440,16 +440,16 @@ def test_multivalued_date_and_time_pair_gets_anonymized():
         dataset.DateOfLastCalibration = original_date = ["20010401", "20010402"]
         dataset.TimeOfLastCalibration = original_time = ["120000", "135959"]
 
-        anonymizer = Anonymizer()
+        anonymizer = Anonymizer(seed="")
         anonymizer.anonymize(dataset)
 
-        new_date_string = dataset.DateOfLastCalibration
-        new_time_string = dataset.TimeOfLastCalibration
+        new_date = dataset.DateOfLastCalibration
+        new_time = dataset.TimeOfLastCalibration
 
-    assert new_date_string != original_date
-    assert len(new_date_string) == len(original_date)
-    assert new_time_string[2:] == original_time[2:]
-    assert len(new_time_string) == len(original_time)
+    assert new_date != original_date
+    assert len(new_date) == len(original_date)
+    assert new_time != original_time
+    assert len(new_time) == len(original_time)
 
 
 @pytest.mark.parametrize(