8000 add utils to examples · rmyers/pyscript@4b2dc2b · GitHub
[go: up one dir, main page]

Skip to content

Commit 4b2dc2b

Browse files
committed
add utils to examples
1 parent 63d7984 commit 4b2dc2b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pyscriptjs/examples/utils.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from datetime import datetime as dt
2+
3+
def format_date(dt_, fmt = "%m/%d/%Y, %H:%M:%S"):
4+
return dt_.strftime(fmt)
5+
6+
def now(fmt = "%m/%d/%Y, %H:%M:%S"):
7+
return format_date(dt.now(), fmt)
8+
9+
def remove_class(element, className):
10+
element.element.classList.remove("line-through")
11+
12+
def add_class(element, className):
13+
element.element.classList.add("line-through")

0 commit comments

Comments
 (0)
0