How to use the memacs.lib.orgformat.OrgFormat.datetupeliso8601 function in memacs

To help you get started, we’ve selected a few memacs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github novoid / Memacs / memacs / lib / orgformat.py View on Github external
def strdate(date_string, inactive=False):
        """
        returns a date string in org format
        i.e.: * 
        @param date-string: has to be a str in following format:  YYYY-MM-DD
        @param inactive: (boolean) True: use inactive time-stamp; else use active
        """
        assert date_string.__class__ == str
        tuple_date = OrgFormat.datetupeliso8601(date_string)
        if inactive:
            return OrgFormat.inactive_date(tuple_date, show_time=False)
        else:
            return OrgFormat.date(tuple_date, show_time=False)
github novoid / Memacs / memacs / filenametimestamps.py View on Github external
"""
        Parses the date+time and writes entry to outputfile

        @param file: filename
        @param link: path
        """
        if TIMESTAMP_REGEX.match(file):
            # if we found a timestamp too,take hours,min
            # and optionally seconds from this timestamp
            timestamp = TIMESTAMP_REGEX.match(file).group()
            orgdate = OrgFormat.strdatetimeiso8601(timestamp)
            logging.debug("found timestamp: " + orgdate)
        else:
            datestamp = DATESTAMP_REGEX.match(file).group()
            orgdate = OrgFormat.strdate(datestamp)
            orgdate_time_tupel = OrgFormat.datetupeliso8601(datestamp)

            if not self._args.skip_filetime_extraction:

                if os.path.exists(link):
                    file_datetime = time.localtime(os.path.getmtime(link))
                    # check if the file - time information matches year,month,day,
                    # then update time
                    if file_datetime.tm_year == orgdate_time_tupel.tm_year and \
                       file_datetime.tm_mon == orgdate_time_tupel.tm_mon and \
                       file_datetime.tm_mday == orgdate_time_tupel.tm_mday:

                        logging.debug("found a time in file.setting %s-->%s",
                                      orgdate, OrgFormat.date(file_datetime, True))
                        orgdate = OrgFormat.date(file_datetime, True)
                else:
                    logging.debug("item [%s] not found and thus could not determine mtime" % link)