Question

I am developing a Japanese mobile site using Datebox calendar. I managed to override most of the date format and labels, but I'm not sure how to modify the title which shows the Month and Year. Instead of showing 6月2013, I want it to show 2013年6月. The two characters basically represent year and month.

I'm using Datebox version 1, and I have overriden the dateFormat and headerFormat as listed below. What am I missing here?

http://dev.jtsage.com/jQM-DateBox1/demos/api/matrix.html#matrix&ui-page=0-0

Datebox version 1 screenshot

Was it helpful?

Solution

It's been a long time since I played with v1. But...

  1. Think about upgrading the v2. Language files stay the same, but v2 is way, way more stable.

  2. You have a couple options for headerFormat -

    a. you can either mess with it in the language file (which I assume you are loading, judging by the fact that english is the default).

    b. Override options..headerFormat.

    c. It looks like just setting options.headerFormat is supposed to override it too... ymmv. Like I said, it's been a while.

  3. The bad news: It is possible that the calendar mode of v1 does not in fact use headerFormat - if that is the case, look for this line, around about 1421, which looks suspiciously hard-coded to me. Which means you'll need to edit the sources directly. Sorry about that.

self.controlsInput.empty().html(o.lang[o.useLang].monthsOfYear[self.theDate.getMonth()] + " " + self.theDate.getFullYear());

Finally, if you do decide to upgrade to v2, it looks like it is also hardcoded - line 160. I'll work on making this an option instead. Edit: the option you are looking for in v2 is overrideCalHeaderFormat / calHeaderFormat.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top