]> git.datanom.net - flask-test.git/blame_incremental - app/momentjs.py
final
[flask-test.git] / app / momentjs.py
... / ...
CommitLineData
1from jinja2 import Markup
2
3class momentjs(object):
4 def __init__(self, timestamp):
5 self.timestamp = timestamp
6
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))
9
10 def format(self, fmt):
11 return self.render("format(\"%s\")" % fmt)
12
13 def calendar(self):
14 return self.render("calendar()")
15
16 def fromNow(self):
17 return self.render("fromNow()")
This page took 0.048456 seconds and 5 git commands to generate.