I changed the data format in Forms.js file *makeDateTime* function to *d/m/y *, looks fine in the plan journey form, however it return me error when I try to plan the journey because the *opentripplanner-api-webapp* still using *m/d/y* format.
Any one know is any other files I need to change, please?
config.js is the place to make such changes. BTW, the goal of config.js is that it's the single place where customization changes like date format, etc... are made (and I don't recommend mucking with Forms.js or other .js files beyond config.js, unless you're adding new functionality).
Anyway, to change the date format, add the following to config.js at about line 14:
otp.config.locale.time.date_format = "d/m/y"; (to be extra thorough, you can also override your chosen locale's date_format, ala otp.locale.English.t ime.date_format = "d/m/y").
BTW, there are two other date / time related format fields to be overridden (and changing those should change date / time formats across the web app):
On Tuesday, July 24, 2012 5:55:28 PM UTC-7, Sarah Matthews wrote:
> Morning Guys
> I changed the data format in Forms.js file *makeDateTime* function to * > d/m/y*, looks fine in the plan journey form, however it return me error > when I try to plan the journey because the *opentripplanner-api-webapp*still using > *m/d/y* format.
> Any one know is any other files I need to change, please?
BTW, I added an otp.locale.English_UK.js to the mix as an alternate to what's in English.js (with the only difference right now being the date & time formats). If there are any other changes (both date formats, and/or string localizations) you'd like to make to English_UK.js Sarah, send them along or check them into a github fork.
On Tuesday, July 24, 2012 5:55:28 PM UTC-7, Sarah Matthews wrote:
> Morning Guys
> I changed the data format in Forms.js file *makeDateTime* function to * > d/m/y*, looks fine in the plan journey form, however it return me error > when I try to plan the journey because the *opentripplanner-api-webapp*still using > *m/d/y* format.
> Any one know is any other files I need to change, please?
On Wednesday, July 25, 2012 6:27:32 PM UTC+9:30, FrankP wrote:
> BTW, I added an otp.locale.English_UK.js to the mix as an alternate to > what's in English.js (with the only difference right now being the date & > time formats). If there are any other changes (both date formats, and/or > string localizations) you'd like to make to English_UK.js Sarah, send them > along or check them into a github fork.
> On Tuesday, July 24, 2012 5:55:28 PM UTC-7, Sarah Matthews wrote:
>> Morning Guys
>> I changed the data format in Forms.js file *makeDateTime* function to * >> d/m/y*, looks fine in the plan journey form, however it return me error >> when I try to plan the journey because the *opentripplanner-api-webapp*still using >> *m/d/y* format.
>> Any one know is any other files I need to change, please?
> // step 2: create an object of default otp.config default values (see > step3 where we apply this to any existing config
> However, the date format still not change on the form and param on the url > ...
> Any idea, please ?
> On Wednesday, July 25, 2012 6:27:32 PM UTC+9:30, FrankP wrote:
>> BTW, I added an otp.locale.English_UK.js to the mix as an alternate to >> what's in English.js (with the only difference right now being the date & >> time formats). If there are any other changes (both date formats, and/or >> string localizations) you'd like to make to English_UK.js Sarah, send them >> along or check them into a github fork.
>> On Tuesday, July 24, 2012 5:55:28 PM UTC-7, Sarah Matthews wrote:
>>> Morning Guys
>>> I changed the data format in Forms.js file *makeDateTime* function to * >>> d/m/y*, looks fine in the plan journey form, however it return me error >>> when I try to plan the journey because the *opentripplanner-api-webapp*still using >>> *m/d/y* format.
>>> Any one know is any other files I need to change, please?
Weird. I'm using the latest code from head, but can't imagine that change wouldn't work fom many versions back (but I did fix a time bug on the intone tart yesterday). Other option is editing English.js directly (but that's not good long term as it bound to change on the future).
On Jul 25, 2012, at 7:34 PM, Sarah Matthews <sarah88.matth...@gmail.com> wrote:
> // step 2: create an object of default otp.config default values (see step3 where we apply this to any existing config
> However, the date format still not change on the form and param on the url ...
> Any idea, please ?
> On Wednesday, July 25, 2012 6:27:32 PM UTC+9:30, FrankP wrote:
> BTW, I added an otp.locale.English_UK.js to the mix as an alternate to what's in English.js (with the only difference right now being the date & time formats). If there are any other changes (both date formats, and/or string localizations) you'd like to make to English_UK.js Sarah, send them along or check them into a github fork.
> On Tuesday, July 24, 2012 5:55:28 PM UTC-7, Sarah Matthews wrote:
> Morning Guys
> I changed the data format in Forms.js file makeDateTime function to d/m/y, looks fine in the plan journey form, however it return me error when I try to plan the journey because the opentripplanner-api-webapp still using m/d/y format.
> Any one know is any other files I need to change, please?
On Thursday, July 26, 2012 12:10:28 PM UTC+9:30, FrankP wrote:
> Weird. I'm using the latest code from head, but can't imagine that change > wouldn't work fom many versions back (but I did fix a time bug on the > intone tart yesterday). Other option is editing English.js directly (but > that's not good long term as it bound to change on the future).
> On Jul 25, 2012, at 7:34 PM, Sarah Matthews <sarah88.matth...@gmail.com> > wrote:
> Me 2, tried yesterday but also not working for me.
> Just think maybe we're using the old otp version. Which version ur using > at moment ?
> On Thursday, July 26, 2012 11:59:06 AM UTC+9:30, Wombatoo wrote:
>> Thanks Frank :P
>> Tried just now, put the code into config.js file as below:
>> // step 1: make sure we have some type of otp.config, and >> otp.config.local defined >> if(typeof(otp) == "undefined" || otp == null) otp = {}; >> if(typeof(otp.config) == "undefined" || otp.config == null) otp.config = >> {}; >> if(typeof(otp.config.locale) == "undefined" || otp.config.locale == null) >> otp.config.locale = otp.locale.English;
>> // step 2: create an object of default otp.config default values (see >> step3 where we apply this to any existing config
>> However, the date format still not change on the form and param on the >> url ...
>> Any idea, please ?
>> On Wednesday, July 25, 2012 6:27:32 PM UTC+9:30, FrankP wrote:
>>> BTW, I added an otp.locale.English_UK.js to the mix as an alternate to >>> what's in English.js (with the only difference right now being the date & >>> time formats). If there are any other changes (both date formats, and/or >>> string localizations) you'd like to make to English_UK.js Sarah, send them >>> along or check them into a github fork.
>>> On Tuesday, July 24, 2012 5:55:28 PM UTC-7, Sarah Matthews wrote:
>>>> Morning Guys
>>>> I changed the data format in Forms.js file *makeDateTime* function to * >>>> d/m/y*, looks fine in the plan journey form, however it return me >>>> error when I try to plan the journey because the * >>>> opentripplanner-api-webapp* still using *m/d/y* format.
>>>> Any one know is any other files I need to change, please?
In this case, you would need to upgrade to the latest code. Not having date format in your code means that things are probably hard wired all over the place...upgrade and you'll benefit from having a single place to change dates (and a few other benefits since).
On Jul 25, 2012, at 9:08 PM, Sarah Matthews <sarah88.matth...@gmail.com> wrote:
> On Thursday, July 26, 2012 12:10:28 PM UTC+9:30, FrankP wrote:
> Weird. I'm using the latest code from head, but can't imagine that change wouldn't work fom many versions back (but I did fix a time bug on the intone tart yesterday). Other option is editing English.js directly (but that's not good long term as it bound to change on the future).
> On Jul 25, 2012, at 7:34 PM, Sarah Matthews <sarah88.matth...@gmail.com> wrote:
>> Me 2, tried yesterday but also not working for me.
>> Just think maybe we're using the old otp version. Which version ur using at moment ?
>> On Thursday, July 26, 2012 11:59:06 AM UTC+9:30, Wombatoo wrote:
>> Thanks Frank :P
>> Tried just now, put the code into config.js file as below:
>> // step 1: make sure we have some type of otp.config, and otp.config.local defined
>> if(typeof(otp) == "undefined" || otp == null) otp = {};
>> if(typeof(otp.config) == "undefined" || otp.config == null) otp.config = {};
>> if(typeof(otp.config.locale) == "undefined" || otp.config.locale == null) otp.config.locale = otp.locale.English;
>> // step 2: create an object of default otp.config default values (see step3 where we apply this to any existing config
>> However, the date format still not change on the form and param on the url ...
>> Any idea, please ?
>> On Wednesday, July 25, 2012 6:27:32 PM UTC+9:30, FrankP wrote:
>> BTW, I added an otp.locale.English_UK.js to the mix as an alternate to what's in English.js (with the only difference right now being the date & time formats). If there are any other changes (both date formats, and/or string localizations) you'd like to make to English_UK.js Sarah, send them along or check them into a github fork.
>> On Tuesday, July 24, 2012 5:55:28 PM UTC-7, Sarah Matthews wrote:
>> Morning Guys
>> I changed the data format in Forms.js file makeDateTime function to d/m/y, looks fine in the plan journey form, however it return me error when I try to plan the journey because the opentripplanner-api-webapp still using m/d/y format.
>> Any one know is any other files I need to change, please?