Commits

Gordon Hemsley  committed 30e2ec3

Add support for using local time for the publication date.

  • Participants
  • Parent commits 199bf1f

Comments (0)

Files changed (2)

                         dest="publication_date", metavar="1 Sep 2022",
                         help="Set the date this document will be published.")
 
+    parser.add_argument("--localtime", action="store_true", dest="localtime",
+                        help="Use local time for the publication date.")
+
     parser.add_argument("--dump-backrefs", action="store_true",
                         dest="dump_backrefs", help=SUPPRESS)
 
         dump_xrefs='',
         use_strict=False,
         publication_date='',
+        localtime=False,
         dump_backrefs=False,
         enable_woolly=False,
         w3c_compat=False,

File anolislib/processes/sub.py

                  w3c_compat_crazy_substitutions=False,
                  w3c_status='',
                  publication_date='',
+                 localtime=False,
                  **kwargs):
         if w3c_status:
             self.w3c_status = w3c_status
         else:
             self.w3c_status = ''
 
-        self.pubdate = publication_date and time.strptime(publication_date, "%d %b %Y") or time.gmtime()
+        self.pubdate = publication_date and time.strptime(publication_date, "%d %b %Y") or localtime and time.localtime() or time.gmtime()
 
         self.stringSubstitutions(ElementTree, w3c_compat,
                                  w3c_compat_substitutions,