Opened 11 years ago

Closed 11 years ago

Last modified 6 years ago

#7717 closed Uncategorized (invalid)

python now() and javascript now-button in admin not the same

Reported by: mikaelm Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Normal Keywords: now_button
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If you have a datetimefield, and press the now button in the admin view you will enter the local time according to your computers timezone, and not according to the servers settings. This might confuse the user.

You have a blog that do not publish the blog post immediately, but after a specific date and time. By pressing the "now" button in the django admin the user would expect the blog post to appear immediately in the blog, but might not do that if the timezone of the server and the computer differ.
class BlogPosts(models.Model):

title = models.CharField(_("title"),max_length=200)

body = models.TextField(_("body"))

visible_after = models.DateTimeField(_("post visible after"))
def list(request):


return list_detail.object_list(



This is perhaps not a bug, but might be perceived as such by the users. One solution would use some ajax-magic that queries the server for the server's own localtime.

Change History (6)

comment:1 Changed 11 years ago by James Bennett

This is expected behavior for JavaScript; if your users are surprised to see that the value they enter in the box for the date/time is the value that actually gets used, perhaps you should have a training session with them to explain this.

comment:2 Changed 11 years ago by James Bennett

Resolution: invalid
Status: newclosed

comment:3 Changed 10 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:4 Changed 8 years ago by Aymeric Augustin

Easy pickings: unset
Severity: Normal
Type: Uncategorized
UI/UX: unset

The same idea was accepted in #14253, and that ticket describes a solution.

comment:5 Changed 6 years ago by Aymeric Augustin

There's a new attempt to fix this in #20663.

comment:6 Changed 6 years ago by Aymeric Augustin <aymeric.augustin@…>

In 7e6d852bac4de2d5ed2d5ddeabf71482d644ef51:

Fixed #20663 -- "Today" and "now" admin shortcuts.

Changed the shortcuts next to date and time intput widgets
to account for the current timezone.

Refs #7717, #14253 and #18768.

Note: See TracTickets for help on using tickets.
Back to Top