]> git.datanom.net - flask-test.git/blob - app/momentjs.py
final
[flask-test.git] / app / momentjs.py
1 from jinja2 import Markup
2
3 class 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.081662 seconds and 6 git commands to generate.