]>
git.datanom.net - flask-test.git/blob - app/momentjs.py
1 from jinja2
import Markup
3 class momentjs(object):
4 def __init__(self
, timestamp
):
5 self
.timestamp
= timestamp
7 def render(self
, format
):
8 return Markup("<script>\ndocument.write(moment(\"%s\").%s);\n</script>" % (self
.timestamp
.strftime("%Y-%m-%dT%H:%M:%S Z"), format
))
10 def format(self
, fmt
):
11 return self
.render("format(\"%s\")" % fmt
)
14 return self
.render("calendar()")
17 return self
.render("fromNow()")
This page took 0.081662 seconds and 6 git commands to generate.