Tags:
create new tag
view all tags

Question

I have a form that includes a date field. The user can click on the calendar icon and click on the date. When this happens the calendar pop up goes away and the date is now populated in the date field of the form. For example, the date displayes as 28 Aug 2008. How can I change it so the date displays as 2008/08/28? I tried changing the default date format in configure but it still comes out as 28 Aug 2008 in the form. Thanks for the help!

Environment

TWiki version: TWikiRelease04x02x00
TWiki plugins: SpreadSheetPlugin, ActionTrackerPlugin, CommentPlugin, EditTablePlugin, InterwikiPlugin, PreferencesPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin, TinyMCEPlugin, TwistyPlugin, WysiwygPlugin
Server OS: Ubuntu 7.10
Web server: Apache 2.2.4
Perl version: Perl 5.8.8
Client OS: Windows XP
Web Browser: IE 6
Categories: Forms

-- MichaelCarter - 28 Aug 2008

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

I think the date format is controlled by a JSCalendarContrib. Set this in twiki/lib/LocalSite.cfg setting:

$TWiki::cfg{JSCalendarContrib}{format} = '%Y-%m-%d';

to get sortable ISO dates such as 2026-02-16

-- PeterThoeny - 30 Aug 2008

Thank you Peter! That did the trick. I know people utilize TWiki for many different things but maybe this would be a better default date format that comes with the initial install. I prefer this format so sorting on dates is easily done. Thanks again!

-- MichaelCarter - 08 Sep 2008

I Peter's trick too: even better than changing the default format would be if the formfield date used the existing configure setting of {DefaultDateFormat}. Then we wouldn't need this tip.

-- SeanCMorgan - 08 Sep 2008

That is what i proposed in UseIsoDates, which was implemented with a compromise, e.g. no change in the default format to ISO date. Please open a new enhancement request to lobby for that useful change.

-- PeterThoeny - 09 Sep 2008

I'm not sure that ISO should the default, because some (mostly Americans? smile ) object to it. The format should only have one configuration point though. That might make it possible to be a user preference too?

The enhancement request is covered by ConvergeDateTimeFormattingModels?

-- SeanCMorgan - 27 Sep 2008

Change status to:
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2008-09-27 - SeanCMorgan
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.