-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add diff support #78
add diff support #78
Conversation
What is the use case in which using |
ok but, why did you add |
nevermind. of course, there is some difference. maybe it's just matter of taste :) sorry for disturbing you |
I did not want to offend you. I sincerely was asking when would you use diff in the template versus just doing (time1 - time2) in Python. The |
oh, no problem at all, don't worry :) my main point is that it's not so easy to get difference between dates in by the way, both moment js also, as i said, probably it's just matter of taste. but it seems not convenient for me to handle this interim "entity" (i mean compareapproach with timedelta in pythonroute @app.route('/timedelta_py')
def timedelta_py():
dt1 = datetime.datetime(1971, 1, 1, 0, 0, 0)
dt2 = datetime.datetime(1970, 1, 1, 0, 0, 0)
return render_template(
'timedelta_py.html',
dt1=dt1,
dt2=dt2,
diff_in_days=(dt1 - dt2).days,
) template ...
dt1: {{ moment(dt1).format('YY/MM/DD') }}
dt2: {{ moment(dt2).format('YY/MM/DD') }}
diff: {{ diff_in_days }} approach using moment jsroute @app.route('/momentjsdiff')
def momentjsdiff():
dt1 = datetime.datetime(1971, 1, 1, 0, 0, 0)
dt2 = datetime.datetime(1970, 1, 1, 0, 0, 0)
return render_template(
'momentjsdiff.html',
dt1=dt1,
dt2=dt2,
) template ...
dt1: {{ moment(dt1).format('YY/MM/DD') }}
dt2: {{ moment(dt2).format('YY/MM/DD') }}
diff: {{ moment(dt1).diff(dt2, 'days') }} |
hi @miguelgrinberg
diff()