How to use the tasklib.local_zone function in tasklib

To help you get started, we’ve selected a few tasklib 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 tbabej / taskwiki / tests / test_vwtask_parsing.py View on Github external
def test_due_full(self):
        self.cache.buffer[0] = "* [ ] Random task (2015-08-08 15:15)"
        vwtask = self.VimwikiTask.from_line(self.cache, 0)

        assert vwtask['description'] == u"Random task"
        assert vwtask['due'] == local_zone.localize(datetime(2015,8,8,15,15))
        assert vwtask['uuid'] == None
        assert vwtask['priority'] == None
        assert vwtask['indent'] == ''
github tbabej / taskwiki / tests / test_vwtask.py View on Github external
def execute(self):
        self.command("w", regex="written$", lines=1)

        # Check that only one tasks with this description exists
        assert len(self.tw.tasks.pending()) == 1

        due = datetime(2015, 3, 3, 0, 0)

        task = self.tw.tasks.pending()[0]
        assert task['description'] == 'This is a test task'
        assert task['status'] == 'pending'
        assert task['due'] == local_zone.localize(due)
github tbabej / taskwiki / tests / test_splits.py View on Github external
def current_year():
    return local_zone.localize(datetime.now()).year
github tbabej / taskwiki / tests / test_vwtask_parsing.py View on Github external
def test_due_short(self):
        self.cache.buffer[0] = "* [ ] Random task (2015-08-08)"
        vwtask = self.VimwikiTask.from_line(self.cache, 0)

        assert vwtask['description'] == u"Random task"
        assert vwtask['due'] == local_zone.localize(datetime(2015,8,8,0,0))
        assert vwtask['uuid'] == None
        assert vwtask['priority'] == None
        assert vwtask['indent'] == ''
github tbabej / taskwiki / tests / test_selected.py View on Github external
def execute(self):
        self.client.type('2gg')
        self.command(
            "TaskWikiStop",
            regex="Task \"test task 2\" stopped.$",
            lines=1)

        for task in self.tasks:
            task.refresh()

        now = local_zone.localize(datetime.now())

        assert self.tasks[0]['status'] == "pending"
        assert self.tasks[1]['status'] == "pending"

        assert (now - self.tasks[0]['start']).total_seconds() < 30
        assert (self.tasks[0]['start'] - now).total_seconds() < 30

        assert self.tasks[1]['start'] == None
github tbabej / taskwiki / tests / test_splits.py View on Github external
def current_month():
    current_month_number = local_zone.localize(datetime.now()).month
    months = ["January", "February", "March", "April",
              "May", "June", "July", "August",
              "September", "October", "November", "December"]

    return months[current_month_number - 1]
github tbabej / task.default-date-time / pirate_add_default_time.py View on Github external
def is_local_midnight(timestamp):
    return timestamp.astimezone(local_zone).time() == time(0,0,0)
github tbabej / task.default-date-time / pirate_add_default_time.py View on Github external
def set_default_time(timestamp):
    return timestamp.astimezone(local_zone).replace(
        hour=DEFAULT_TIME.hour,
        minute=DEFAULT_TIME.minute,
        second=DEFAULT_TIME.second,
        )