diff --git a/mercurial/util.py b/mercurial/util.py
index 2f93a4a101441c9f09d1d4f332cc94ad20fe29d5_bWVyY3VyaWFsL3V0aWwucHk=..28f557e8b4198d58a65621447544f0eec7048eb3_bWVyY3VyaWFsL3V0aWwucHk= 100644
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1222,6 +1222,8 @@
     if not date:
         raise Abort(_("dates cannot consist entirely of whitespace"))
     elif date[0] == "<":
+	if not date[1:]:
+            raise Abort(_("invalid day spec. use '<{datetime}' "))
         when = upper(date[1:])
         return lambda x: x <= when
     elif date[0] == ">":
@@ -1225,6 +1227,8 @@
         when = upper(date[1:])
         return lambda x: x <= when
     elif date[0] == ">":
+	if not date[1:]:
+            raise Abort(_("invalid day spec. use '>{datetime}' "))
         when = lower(date[1:])
         return lambda x: x >= when
     elif date[0] == "-":
diff --git a/tests/test-log.t b/tests/test-log.t
index 2f93a4a101441c9f09d1d4f332cc94ad20fe29d5_dGVzdHMvdGVzdC1sb2cudA==..28f557e8b4198d58a65621447544f0eec7048eb3_dGVzdHMvdGVzdC1sb2cudA== 100644
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -522,6 +522,18 @@
 
   $ hg log -d -1
 
+log -d ">"
+
+  $ hg log -d ">"
+  abort: invalid day spec. use '>{datetime}'
+  [255]
+
+log -d "<"
+
+  $ hg log -d "<"
+  abort: invalid day spec. use '<{datetime}'
+  [255]
+
 
 log -p -l2 --color=always