473,388 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Problems with Date.toLocaleTimeString

Hi Guys

We shipped our software out to a customer that contains a piece of
javascript that looks like this:

var date = new Date();
var time = date.toLocaleTimeString();

...Which works on all the QA systems and our dev machines, but doesn't
seem to work on one of the customers testing machines, they get the
following message:

"Object does not support property or method", in a `do you wish to
debug this script?` dialog. If they click yes; Microsoft Script
Debugger is launched and it complains that the second line with the
`toLocaleTimeString` method is the culprit.

They are indeed running IE 6 (v6.0.2800.1106) on a `Win2K SP4 server
box` (which in fairness we havent tested it with) but I cant understand
if they are running the same version of IE as us, why the javascript
wont work?! Should it matter they are using Win2k and we are using
Xp/2K3??? I thought the jscript library was part of IE itself?

If anybody has run into this problem, or knows why this is happening
please please please could you help me out?

Many Thanks

Tom Medhurst

May 5 '06 #1
5 4497
VK

Beeker wrote:
Hi Guys

We shipped our software out to a customer that contains a piece of
javascript that looks like this:

var date = new Date();
var time = date.toLocaleTimeString();

..Which works on all the QA systems and our dev machines, but doesn't
seem to work on one of the customers testing machines, they get the
following message:

"Object does not support property or method", in a `do you wish to
debug this script?` dialog. If they click yes; Microsoft Script
Debugger is launched and it complains that the second line with the
`toLocaleTimeString` method is the culprit.

They are indeed running IE 6 (v6.0.2800.1106) on a `Win2K SP4 server
box` (which in fairness we havent tested it with) but I cant understand
if they are running the same version of IE as us, why the javascript
wont work?! Should it matter they are using Win2k and we are using
Xp/2K3??? I thought the jscript library was part of IE itself?


It also part of Windows Host installation, and this is frequently
forgotten by sysadmins. So if the admin installed/reinstalled wshost
she could override the jscript.dll back to v5.1 (supplied with Win
2000) while toLocaleTimeString supported only since v5.5

Ask your clients to run
alert(ScriptEngineMajorVersion + "." + ScriptEngineMinorVersion);
and tell the version they will see.

If I'm right then:

1) Ask the admin to reinstall the latest JScript engine from
<http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en>

2) Tell to admin to read specs before installing/reinstalling Windows
component - if he still wants to get his doughnuts :-)
P.S. Overall it would be wise to add script engine check in your code
to fall back without spooky errors. Careless admins are not so rare.

May 5 '06 #2
VK

VK wrote:
I thought the jscript library was part of IE itself?

It also part of Windows Host installation,


I mean Windows Script Host installation.

And no, it's not an internal block of IE. It is a Windows library by
its own at %windows%jscript.dll

May 5 '06 #3
Wow, cheers for that response. Will try it out on Monday and let you
know.
I'll save the doughnuts for someone who deserves them, I think!! So
next time your in the area... ! :p

Will let you know the outcome.
Thanks again

Tom

May 5 '06 #4
VK

Beeker wrote:
Wow, cheers for that response. Will try it out on Monday and let you
know.
I'll save the doughnuts for someone who deserves them, I think!! So
next time your in the area... ! :p

Will let you know the outcome.
Thanks again


You are welcome... There is an ongoing campain run by some in Usenet to
prove that Gougle Groups users are second or even third quality people
because they unbellyfeel the Usenet As It Really Is :-) To not give
then extra arguments :-), you may want to quote some minimum of text
you are replying to.

May 5 '06 #5
JRS: In article <11**********************@g10g2000cwb.googlegroups .com>
, dated Fri, 5 May 2006 03:36:50 remote, seen in
news:comp.lang.javascript, Beeker <to**********@exony.com> posted :

We shipped our software out to a customer that contains a piece of
javascript that looks like this:

var date = new Date();
var time = date.toLocaleTimeString();

..Which works on all the QA systems and our dev machines, but doesn't
seem to work on one of the customers testing machines,

Method toLocaleTimeString is comparatively recent.

You could probably use toLocaleString and use a RegExp replace (or other
method) to strip off the date part.

It seems safe to assume that the date part will contain \d{4} and be
delimited by whitespace, but not necessarily that it will be first.

For me,

new Date().toLocaleString().replace(/(\s?\S*\d{4}\S*\s?)/, "")
-> 23:20:30

new Date().toLocaleString()
-> 05/05/2006 23:20:43

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
May 5 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Magnus Ullberg | last post by:
How do i convert the following structure declaration from c++ to c#? #pragma pack(push,1) //Byte alignment struct TtsrPlayerInfo { int PlayerID; int ChannelID; char NickName; int...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
4
by: Michael Augustine | last post by:
I am having problems debugging an Web form app in .net. I am getting the following error message "Unable to Start Debugging on the Webserver. Catostrophic Failure." I think the problem has to...
17
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control...
2
by: Brian Shade | last post by:
Hi everyone, I am fairly new to developing with APS.NET and I have run into a big roadblock. I am trying to open up a solution file for Visual Studio ..NET 2003. Every time I try to open it I...
1
by: Duffman | last post by:
Hi, I have what seems to be a common problem, but the solutions I've found don't seem to work. I would like to use a web service to create a file at a UNC location in a shared file. Currently...
1
by: Mark Olbert | last post by:
I've written a custom MembershipProvider and a custom RoleProvider, and am trying to get them to work with the ASP.NET Configuration tool. Which is a royal pain in the butt, because there doesn't...
3
by: Andreas | last post by:
Hi! I'm currently developing a DLL that makes use of C++ and .net (mixed) using Visual Studio 2003. Now, as I wanted to move to the new Visual Studio 2005, I converted this project into the...
2
by: tdr911turbo | last post by:
Find solution for your problem with powerful tips and tricks for your operating system http://windowsxpsp2pro.blogspot.com
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.