Hi,
If I give a date like Mon Dec 06 1948 23:44:40 GMT-0800 (PST) to
context.jsToJava to convert to date I get
Tue Dec 07 00:44:40 PDT 1948 from Rhino.
This happens only if your machine clock has time between 11pm to
11.59.59 pm.
I think it has something to do with NAtiveDate.class. (note my year
is 1948)
I tried for various years though but does nor necessarily fail for
everything below 1970 and above 1948.
private static double DaylightSavingTA(double t)
{
// Another workaround! The JRE doesn't seem to know about DST
// before year 1 AD, so we map to equivalent dates for the
// purposes of finding dst. To be safe, we do this for years
// outside 1970-2038.
if (t < 0.0 || t > 2145916800000.0) {
int year = EquivalentYear(YearFromTime(t));
double day = MakeDay(year, MonthFromTime(t), DateFromTime
(t));
t = MakeDate(day, TimeWithinDay(t));
}
if (!TZO_WORKAROUND) {
Date date = new Date((long) t);
if (thisTimeZone.inDaylightTime(date))
return msPerHour;
else
return 0;
} else {
/* Use getOffset if inDaylightTime() is broken, because it
* seems to work acceptably. We don't switch over to it
* entirely, because it requires (expensive) exploded date
arguments,
* and the api makes it impossible to handle dst
* changeovers cleanly.
*/
// Hardcode the assumption that the changeover always
// happens at 2:00 AM:
t += LocalTZA + (HourFromTime(t) <= 2 ? msPerHour : 0);
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino