Skip to content

Commit

Permalink
[MINOR]: std.title and timestamp to datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
amadolid committed Feb 19, 2024
1 parent d31850e commit 0ebac08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jaseci_core/jaseci/extens/act_lib/date.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Built in actions for Jaseci"""

from datetime import datetime, timedelta
from jaseci.jsorc.live_actions import jaseci_action
from dateutil.relativedelta import relativedelta
Expand Down Expand Up @@ -51,6 +52,11 @@ def timestamp_now():
return int(datetime.utcnow().timestamp())


@jaseci_action
def timestamp_to_datetime(timestamp: int):
return datetime.fromtimestamp(timestamp)


@jaseci_action()
def datetime_obj(date: str = None):
"""Get utc date time now or parse one to dict format"""
Expand Down
6 changes: 6 additions & 0 deletions jaseci_core/jaseci/extens/act_lib/std.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Built in actions for Jaseci"""

from operator import itemgetter
from jaseci.utils.utils import app_logger, json_out
from datetime import datetime
Expand Down Expand Up @@ -233,3 +234,8 @@ def log_activity(
@jaseci_action()
def clear_cache(all: bool = True, meta: dict = {}):
meta["h"].clear_cache(all)


@jaseci_action()
def title(string: str):
return string.title()

0 comments on commit 0ebac08

Please sign in to comment.