0

So I'm developing the AMP version of a web in Django.

The problem is that when Google Caches my content it takes the timezone of the Google server that caches the content (EDT) and no the local timezone of my users, so they are getting the wrong time.

What can I do to solve this?

Thanks!

Bachcha Singh
  • 3,850
  • 3
  • 24
  • 38
Lader
  • 1
  • 1
  • 1
  • Can you provide some more context as to what timestamp you're trying to localize? Is it just a date on the page, a timeago timestamp, or for analaytics? There's possibly already a solution out there depending on what you're trying to do. – James Ives Oct 29 '18 at 23:29
  • It's just a date on the page – Lader Nov 02 '18 at 02:30

1 Answers1

0

The easiest way I can think of would be to use amp-iframe to load the specific bit of content from the server which shows the time. That will allow you to run custom javascript, if you're localizing it client side. There are a couple of answers on this question which discuss using amp-iframe when you need to do custom javascript.

smlync
  • 369
  • 9
  • 15
  • The thing is that I localize the date with Django. See this https://docs.djangoproject.com/es/2.1/topics/i18n/timezones/#timezone – Lader Nov 05 '18 at 23:49
  • Sorry, I don't understand. Why would amp-iframe not be a valid solution? You would need to create a page (which server side framework is used shouldn't matter) which returns valid html with just the local time or time zone. That's your target for the amp-iframe. – smlync Nov 07 '18 at 00:40