1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

xenforo locale ==> date problem

Discussion in 'XenForo Development Discussions' started by ragtek, Dec 28, 2010.

  1. ragtek

    ragtek Guest

    Hi, i'm trying to get this output in the template:

    January 2010
    April 2011
    or at least
    01-2010
    04-2010
    (or whatever you have in the US^^)
    I've tried to add:
    <td>{xen:date $stat.date, 'M.Y'}</td><td>{$stat.registrations}</td>
    to the template, but it's not working

    As i checked the method, which is responsible for this, i saw that it's not possible.
    Do i really need to overwrite this method also, or is there a other way for this?:(
     
  2. Shadab

    Shadab Well-Known Member

    The 2nd parameter (format) only accepts these values: relative, absolute, monthDay, and picker. So no you can't pass a format you would normally pass to php's date() function.

    You can always create your own template helper!
     
  3. ragtek

    ragtek Guest

    FYI, since beta6 it's possible

     
  4. Kier

    Kier XenForo Developer Staff Member

    For a list of the formatting characters we support, look at XenForo_Locale::getFormattedDateInternal(), where there is a switch statement you can read.
     
  5. ragtek

    ragtek Guest

    thx,
     
  6. Garani

    Garani Active Member

    Sorry to resurrect this thread. "picker" as in "Date Picker"?

    I need to input some data and I did set up a DatePicker from jQuery on my own, though if the hoks are already within XenForo it wuld be useless to make the user load more garbage then necessary ;)
     
  7. Kier

    Kier XenForo Developer Staff Member

    Yes, we already implement one. You can see it in the date field of the search popup.

    Using it is as simple as this:
    HTML:
    <input type="date" />
    The XenForo JavaScript framework will do the rest.
     
    KenSmith and Krochinzky like this.

Share This Page