1

Our goal is to set the timezone on the frontend part to display the dates/times on the timezone that we desire and also get the dates generated from datefields, timefields etc. to be on the same timezone but at the end send the correct timestamp to the server.

Setting the timezone globally to a javascript application is not a trivial task according to this: How to initialize javascript date to a particular timezone

The solutions recommend libraries like momentjs, and please correct me if I am wrong, but this is out of the scope and incompatible with sencha extjs. In other words there are too many time conversions in Models and Components handled by sencha extjs that we cannot bypass.

In addition there is an effort to override the core functionality of Date object of javascript language itself found here: https://github.com/pligor/jstimezoner
While the above works for simple cases when integrated with a sencha extjs application the outcome is a disaster and not recommended.

Is there any configuration that we are missing that enables Sencha ExtJS to display and handle times and dates on a timezone of our choice?

Note that we always send/receive a timestamp to/from the server and therefore there is no issue of timezones there.

Community
  • 1
  • 1
George Pligoropoulos
  • 2,919
  • 3
  • 33
  • 65

1 Answers1

0

Just like ExtJS doesn't really support internationalization, it doesn't support time zones.

We searched the internet and also stumbled upon MomentJS. But as you found out, you can then start to rewrite nearly everything in ExtJS that handles dates: You need a datetimewzonepicker, a model field of type:'datetimewzone', a datetimewzonecolumn and so on and so forth.

Back then, it seemed too much of an effort and we decided that it would be easier to send the desired client time zone to the server in every request, sending the corresponding datetime back and forth in Y-m-d H:i format, and doing everything else regarding time zones on the server. We regret this decision now, because that way, we have no possibility to calculate on the client side (e.g. cordova app in offline mode).

If you are proficient in ExtJS, writing all these momentdate-handling ExtJS extensions should be not only the clean and extensible, but also the easier way.

Alexander
  • 19,906
  • 19
  • 75
  • 162
  • It strokes me as a surprise since they would always punch me in the face whenever I would use something else than a timestamp on the server side :) You only need to bring timezone and other presentation info on the presentation layer which I believe you agree. Are you considering of releasing your next stable version (6.0.3 I guess) by including the timezone functionality? This is not a feature request. It is actually a bug. Thank you for your consideration – George Pligoropoulos Jun 15 '16 at 07:58
  • I am not an ExtJS representative, just an ExtJS developer, and "we" doesn't mean the official Sencha team. "We" are a small team developing a business calendar application based on ExtJS. But as far as I know, Sencha doesn't consider improving internationalization or timezones. You can ask via official support channels (X-Credits, Sencha Forum). We did back then before 4.2.2 was out, and didn't get a positive response. – Alexander Jun 15 '16 at 08:06
  • The same guy who responds to me at support is named Alex, thus the misunderstanding. Sorry for that. The question is still valid for Sencha ExtJS officials in case they stumble upon it – George Pligoropoulos Jun 15 '16 at 08:19