Browse Source

fix --night-threshold

boyska 8 months ago
parent
commit
28bcbd9f1e
1 changed files with 4 additions and 0 deletions
  1. 4 0
      ics2yaml.py

+ 4 - 0
ics2yaml.py

@@ -1,5 +1,6 @@
 #!/usr/bin/python3
 
+import sys
 import logging
 import argparse
 import os.path
@@ -132,6 +133,9 @@ class PelicanConverter(Converter):
             fpath = talkdir / fname
             self.changed_files.append(fpath)
             day = (talk.decoded('DTSTART').date() - self.talks_metadata['startdate']).days
+            after_midnight = talk.decoded('DTSTART').hour < self.args.night_threshold
+            if after_midnight:
+                day -= 1
             frontmatter = dict(
                 key=uid,
                 title=talk.decoded("SUMMARY").decode("utf8"),