Author |
Topic |
Andy Humm
Average Member
United Kingdom
908 Posts |
Posted - 29 October 2008 : 08:32:08
|
I have been trying for a long while to get the dates that display in the input fields of the calendar mod to be in the same format as the rest of the forum. The config LCID is set to 1033, my admin Server Date/Time Configuration Date Format is set to UK Long As you can see from the image the input dates are mm/dd/yyyy
Any help in altering the code to change these displayed dates to dd/mm/yyy, the same as the rest of the forum date displays, would be gratefully appreciated.< |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 29 October 2008 : 08:39:57
|
Can you throw up a link to a *.txt copy of that file?
< |
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 29 October 2008 : 11:07:37
|
if you have your dates set to UK long in admin then your forum dates should not be displayed as dd/mm/yyyy anyway, that is short date format, long date format displays as dd monthname yyyy so what exactly do you want as your explanation is not correct, so, do you want them as set in your admin (uk long) or do you want them to work as uk short as you indicate by dd/mm/yyyy
< |
MVC .net dev/test site | MVC .net running on Raspberry Pi |
|
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 30 October 2008 : 18:36:13
|
Change you LCID to: Session.LCID = 2057< |
|
|
AnonJr
Moderator
United States
5768 Posts |
Posted - 30 October 2008 : 19:51:04
|
I suspect, without having looked at the files, that the MOD probably does not do the final conversion to Forum Time and/or does not use the forum software's built in date/time functions. That is probably the root cause of the problem.
This assumption is based on my work with some MODs (and some personal work I've done) that essentially recreated things that already existed in the forum software or didn't use them (willingly or through ignorance).< |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
|
Webbo
Average Member
United Kingdom
982 Posts |
Posted - 31 October 2008 : 03:11:13
|
Hi HuwR, why is that ?
(I'm genuinely asking the question because I don't know )< |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 31 October 2008 : 05:34:03
|
because you don't need to and doing so will cause unforseen problems because of the way asp deals with dates, changing the LCID means you will have to rewrite the forums datetime functions, which is unnecesary since the forum already allows you to format in both uk and us date formats it does not require changing the LCID to do that.
we do not write code comments like DO NOT CHANGE this value just because we feel like it, we do so because changing it will break your forum.< |
MVC .net dev/test site | MVC .net running on Raspberry Pi |
|
|
Andy Humm
Average Member
United Kingdom
908 Posts |
Posted - 31 October 2008 : 06:24:49
|
Webbo, I did initially have my LCID at 2057, under the advise of Shaggy a few years ago and all seemed well. However, when using the greetings card mod, I experienced problems with the dateadd function, and eventually reverted the LCID back to 1033.
With this in mind, the dates in the calendar mod input fields all show mm/dd/yyyy.
Knowing what Huwr has mentioned above about date time functions etc and the LCID, it seems that the code may be incorrect in the calendar mod as all the other mods and base forum work and display ok with 1033 and UK long settings, even the database dateadd works.
Re quote from Huwr if you have your dates set to UK long in admin then your forum dates should not be displayed as dd/mm/yyyy anyway, that is short date format, long date format displays as dd monthname yyyy so what exactly do you want as your explanation is not correct, so, do you want them as set in your admin (uk long) or do you want them to work as uk short as you indicate by dd/mm/yyyy
I have tried the UK Short and UK long settings and the date display under the calendar input fields remain mm/dd/yyyy. I can see the logic behind what you say. Ideally for the input fields we need dd/mm/yyyy and not dd/mmmm/yyyy
Here are the txt files as requested: cal.asp link cal_post.asp link cal_post_info1.asp link cal_post_info2.asp link post.asp link< |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 31 October 2008 : 06:54:50
|
In "cal_post.asp"
if not rsCal.EOF then Event_Date = ChkDate(rsCal("EVENT_DATE"),"",false)
rsCal.Close
set rsCal = nothing
End If
Else
If Event_Date = "" then Event_Date = ChkDate(DateToStr(strForumTimeAdjust),"",false)
End If Change "false" to "true" if you want to display the time.< |
_-/Cripto9t\-_ |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 31 October 2008 : 07:46:47
|
if you want to enter the dates as UK short then you really need to set the forum to display as UK short not UK long, otherwsie you will confuse the forum.
to be honest if you have a calender that allows selection of dates I would remove the date input box altogether, it is far more difficult to control the users input than when using the calendar date selector.
< |
MVC .net dev/test site | MVC .net running on Raspberry Pi |
|
|
Andy Humm
Average Member
United Kingdom
908 Posts |
Posted - 01 November 2008 : 16:52:25
|
Huwr, I have tried either UK Short,Med or Long date and still the dates in the inpute fields show as mm/dd/yyyy. Looking at the suggestion to remove the input date fields I tried this by changing the require firelds from "text" to "hidden" which achieves the objective to not display the input field but when you select a date on the datepicker there is no visual feedback to show you the date selected. Previously when you click a date in the picker the input field changed to show you the new date.
Given cripto9t's suggestion the input dates still remain in mm/dd/yyyy so I have tried the next few line on the code
In cal_post.asp
I have changed the items in red from Event_Date to chkdate(datetostr(Event_Date),"",false) and the input field shows the date format on opening the page as 1 November 2008 (because I have UK Long set in Admin server time format) but when you click on a new date in the date picker the date shown in the input field changes to mm/dd/yyyy
I have searched for the code to see why this happens, no avail. Huwr's idea about removing the input field seems a better notion as we remove the requirement to manually input dates - but could we somehow show the date picker date that has been selected in a response write , any clues would be appreciated.
Correct me if I am wrong, but the input field code will need to stay, albeit hidden, so that the data can be recorded in the db. So if we add a response write in the same location on the page it will show the new date.
Thanking you in advance Andy
Edit to put code in scrollcode box< |
Edited by - Andy Humm on 01 November 2008 16:54:52 |
|
|
cripto9t
Average Member
USA
881 Posts |
Posted - 01 November 2008 : 18:28:02
|
The changes I posted and the changes you posted should have the same results. ie. work on the initial page load.
To get the chkDate function to work with the date picker, I think this bit of code in "cal_datepicker.asp" needs reworked to come out formatted "yyyymmdd".
'Days of the week
Response.Write " <TR>"
dayofWeek = intCalFirstDayofWeek - 1
For i = 1 to 7
Response.Write "<TD>" & WeekDayName(dayofWeek mod 7 + 1, 1) & "</TD>"
dayofWeek = dayofWeek + 1
Next
Response.Write "</TR>" & vbnewline
'Get the first and last days of the month
dtMonthStart = DateSerial(Year(dateToDraw), Month(dateToDraw), 1)
dtMonthEnd = DateSerial(Year(dateToDraw), Month(dateToDraw)+1, 1-1)
'Set the moving date to the first day of the month
dateCursor = dtMonthStart
'Move to the first day of the week
Do Until Weekday(dateCursor) = intCalFirstDayofWeek
dateCursor = DateAdd("d", -1, dateCursor)
Loop
'There are as many as 6 weeks in a month!
For i = 1 to 6
Response.Write " <TR>"
'7 days in a week
For j = 1 to 7
'Only draw the date if it falls within the month
If dateCursor < dtMonthStart or dateCursor > dtMonthEnd then
Response.Write "<TD></TD>"
Else
Response.Write "<TD>" & _
"<A HREF=""javascript:returnDate('" & DateSerial(Year(dateCursor), Month(dateCursor), Day(dateCursor)) & "'); "">" & Day(dateCursor) & "</A>" & _
"</TD>"
End If
'Move to the next day
dateCursor = DateAdd ("d", 1, dateCursor)
Next
Response.Write "</TR>" & vbnewline
Next it may be a simple fix or mayby not, I don't know. I dont't have the mod installed. I'm just looking at the code.
ps - The DateSerial() function is a vbs function and is the reason the date is formatted the way it is.< |
_-/Cripto9t\-_ |
|
|
Carefree
Advanced Member
Philippines
4207 Posts |
Posted - 01 November 2008 : 22:00:04
|
In "cal_post.asp", look for this:
Replace it with this:
In "cal_datepicker.asp", look for this:
Replace it with this:
While not the most elegant solution, it is working.< |
|
|
Andy Humm
Average Member
United Kingdom
908 Posts |
Posted - 02 November 2008 : 16:00:43
|
CF Thank you for the suggestion, and I tried the code, when clicking on date picker the input field changes to dd/mm/yyyy as asked, However, if I select from datepicker startdate as 2/11/08 and enddate as 26/11/08 and submit the calendar entry I get the following: There has been a problem! Recurring Events cannot have more than 90 dates
Also if I select startdate 2/11/08 and enddate 3/11/08 I find that an entry has been made in: (11th Feb to 11th March) 2008 February 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 2008 March 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
Is this because the LCID as 1033 is still sending a date to the database in mm/dd/yyyy format < |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 02 November 2008 : 17:01:44
|
it is nothing to do with the lcid being 1033, it is a result of the dates not being formatted and processed using the forums date functions. if it is not done using the forums date functions then it is not compatible with the forum.
dates should not be stored in the database in any other format than a string YYYYMMDDHHMMSS doing it any other way will give you problems. as long as you do this, and then use the forum strtodate/datetostr functions you will not have a problem.< |
MVC .net dev/test site | MVC .net running on Raspberry Pi |
|
|
Topic |
|
|
|