← Back to team overview

dhis2-devs-core team mailing list archive

Calendar / DatePicker updates

 

Hi guys

As you have probably noticed, I have been working on implementing support
for a more generic calendar in DHIS 2 (to support my ongoing work to have
the Nepali calendar supported).

This work is happening in branch
https://code.launchpad.net/~dhis2-devs-core/dhis2/localized-calendar (I
hope to have it merged soon).

What is working:
- Calendar and date format can be set in general settings -> calendar
- Data entry is updated to show proper local dates, will be converted to
iso periods when saved
- Add/edit orgUnit opening/closed date is using localized date picker

To have this working, I have implemented:

Java:
- A new Calendar interface with multiple implementations
- A new CalendarService which gives you current calendar and current date
format

JavaScript:
- A new Period generator has been implemented which uses the system
calendar to generate periods
- A new localized date picker have been implemented which uses system
generator

If you use main.vm to bootstrap your page, you can use these two new global
variables:
dhis2.period.generator
dhis2.period.picker

And you can find more information about the API in dhis2.period.js (in
commons)

What I need from you guys:
- If you want to get todays date, please use calendar.today(), and not jdk
Calendar / Date since these are not localized
- For any kind of date / calendar manipulation, please use calendar again
(it has plusDays, plusWeeks etc)
- If you use jquery ui date picker, please use the global date picker
instead
- When saving dates to the database, please convert to iso first
(calendar.toIso), and convert to local when getting values out
(calendar.fromIso)

Jan: for extjs, please have a look at how the extjs date picker can be
customized, you should be able to use the generator, but I'm not sure about
the date picker..

For 2.16 I think we will stop at input, all outputs will be implemented in
2.17

Please, if you have any questions / bug reports, please write directly and
I will have a look

--
Morten

Follow ups