Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #36562

Re: Opera browser, localisation of toLocaleString and of spell-check?

Newsgroups comp.lang.javascript
Subject Re: Opera browser, localisation of toLocaleString and of spell-check?
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <e0405e6a-4af4-4e30-a954-3fbbb56d563e@googlegroups.com> <XnsAA445CFC9E61Feejj99@194.109.6.166> <62e970e4-03d1-43a9-8e8d-530b43114121@googlegroups.com>
Date 2019-05-03 15:38 +0200
Message-ID <XnsAA449F1A6569Ceejj99@194.109.6.166> (permalink)

Show all headers | View raw


dr.j.r.stockton@gmail.com wrote on 03 May 2019 in comp.lang.javascript:

> On Friday, 3 May 2019 08:08:38 UTC+1, Evertjan.  wrote:
>> JRS wrote on 02 May 2019 in comp.lang.javascript:
>> 
>> > I have three Windows 10 PCs, with Opera 60.0 update done today.
>> > Opera and Windows are set, as far as I know possible, for UK
>> > and for ISO 8601 date and time, YYYY-MM-DD hh:mm:ss 24-hr.
>> > 
>> > In one PC, using Opera, new Date().toLocaleString() gives a British
>> > date and 24-hour clock, :-) .  In the others, it gives a US date
>> > and AM/PM clock, :-( .
>> > 
>> > How do I rectify that?
>> 
>> Do not use these browser and locale dependent nonsense,
>> not in JS, not in VBS, not etc.,
>> and build your own date/time strings from scratch.
>> 
>> I just copy such scratch-functions from script to script,
>> and adapt them at will.
> 
> The Web is not a write-only medium, and even assiduous authors
> sometimes find it necessary to read pages written by the
> incompletely enlightened.  So I want each of my browsers to work
> in the same way on each of my PCs (and, if possible, to work
> correctly).
> 
> I have many such functions in include files, such as INC-DATE.JS,
> as you may remember.  But here I don't want to use include files;
> I want to be able to send the page that I am writing by E-mail as
> an attachment, and one which will not need to have auxiliary stuff
> sent as well.  So, after writing the page with my standard
> auxiliary *.JS and *.CSS files, I have incorporated the small
> amount of JS and CSS needed within the page itself.  I can do the
> same with the date functions.

Well, methinks you cannot weapon yourself against yet unknown bad pages.

> Here's a thought : Given any all-numeric date+time string with
> separated fields, one can usually, but not always, identify at
> sight which field is which.

So what about 03/05/2019 and 05/03/2019 ?

And 19/03/05 ?

And what zone is '17:28 +02:00 GMT' ?
 
> If it is known 

Well, I submit it is not.

> that a string represents the date+time 2001-02-03
> 04:05:06, one can always identify the fields by their final
> digits.  One can easily generate a Date Object with that value,
> GMT or LCT, from new Date(0) by numerically setting the fields.
> So one can now, by RegExps, generate from that Date Object a
> string containing (not necessarily only) the digits 123456
> representing the field order.  One should be able to use that to
> cause a RegExp to rearrange the date+time supplied into ISO order;
> and that means that one can do the same with that digit string to
> rearrange any string of the original format into the proper order.
> It is the penultimate step which currently eludes me.
> 
> Note : I do not need the answer, but it would be nice to have it.

Yes, when you understand the specific ludicrous idea's of the distant 
scripter, regex can help you out, I presume. Otherwise you have to trust 
your runtime instinct or allow your code to make an even bigger mess than 
the original mess.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Opera browser, localisation of toLocaleString and of spell-check? dr.j.r.stockton@gmail.com - 2019-05-02 11:56 -0700
  Re: Opera browser, localisation of toLocaleString and of spell-check? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-05-02 22:57 -0700
    Re: Opera browser, localisation of toLocaleString and of spell-check? dr.j.r.stockton@gmail.com - 2019-05-03 04:10 -0700
      Re: Opera browser, localisation of toLocaleString and of spell-check? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-05-03 11:42 -0700
        Re: Opera browser, localisation of toLocaleString and of spell-check? dr.j.r.stockton@gmail.com - 2019-05-04 05:26 -0700
  Re: Opera browser, localisation of toLocaleString and of spell-check? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-03 09:08 +0200
    Re: Opera browser, localisation of toLocaleString and of spell-check? dr.j.r.stockton@gmail.com - 2019-05-03 04:11 -0700
      Re: Opera browser, localisation of toLocaleString and of spell-check? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-03 15:38 +0200
        Re: Opera browser, localisation of toLocaleString and of spell-check? dr.j.r.stockton@gmail.com - 2019-05-03 11:39 -0700
          Re: Opera browser, localisation of toLocaleString and of spell-check? Flng Fck <nothanks@invalid.invalid> - 2019-05-06 09:28 +0200
            Re: Opera browser, localisation of toLocaleString and of spell-check? dr.j.r.stockton@gmail.com - 2019-05-06 02:36 -0700
              Re: Opera browser, localisation of toLocaleString and of spell-check? Flng Fck <nothanks@invalid.invalid> - 2019-05-06 12:31 +0200
              Re: Opera browser, localisation of toLocaleString and of spell-check? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-05-06 22:20 +0200

csiph-web