Date object

Any idea why the date object in Freeway returns a totally incorrect date?

Try this;

<page-action>
<action-javascript>
	function fwAfterEndBody(){
		alert(new Date());
	}
</action-javascript>
</page-action>

What I get back is;
Mon Jun 11 06:54:02 GMT+0100 (BST) 2012

Safari gives me the correct date;
Fri Jun 15 2012 16:45:44 GMT+0100 (BST)

Regards,
Tim.

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Does anything change if you set the date to a variable first, and alert the variable? I’m thinking it may be an order of operation thing. Also, look at any of the accessors in the Date object, rather than just relying on the default that comes when you cast the object to string.

var d = new Date();
alert(d.toLocaleString());
alert(d.getDate());
alert(d.getUTCDate());
alert(d.toUTCString();

There’s a good list of things to try here: Date - JavaScript | MDN

As far as why this might be the case, I would put it down to using an ancient fork of Mozilla’s JavaScript engine from back when Freeway 2 was a thing. I don’t know how or how much it’s been updated since that epoch, but as far as I know, that’s the Genesis of JavaScript in Actions.

Walter

On Jun 15, 2012, at 11:47 AM, Tim Plumb wrote:

Any idea why the date object in Freeway returns a totally incorrect date?

Try this;

<page-action>
<action-javascript>
	function fwAfterEndBody(){
		alert(new Date());
	}
</action-javascript>
</page-action>

What I get back is;
Mon Jun 11 06:54:02 GMT+0100 (BST) 2012

Safari gives me the correct date;
Fri Jun 15 2012 16:45:44 GMT+0100 (BST)

Regards,
Tim.

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Tim,

The “Current Date” Action (which you wrote) seems to display the correct date…

Jeremy


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks for the input here.

The date object in Freeway still wants me to believe that the date is Monday June 11th 2012 (rather than Friday June 15th).

Jeremy, the Current Date Action works because all of the date manipulation is done in the browser rather than in Freeway. For the moment I’ve got a timestamp from Terminal which works perfectly fine with the only downside being the Action needs AppleScript enabled to run.

Walter, do you get the correct date if you run this Action?

<page-action>
<action-javascript>
	function fwAfterEndBody(){
		alert(new Date());
	}
</action-javascript>
</page-action>

I’m wondering if I’ve somehow managed to mangle Freeway’s internal timezone or offsets over the years.
Regards,
Tim.

On 15 Jun 2012, at 17:16, Walter Lee Davis wrote:

Does anything change if you set the date to a variable first, and alert the variable? I’m thinking it may be an order of operation thing. Also, look at any of the accessors in the Date object, rather than just relying on the default that comes when you cast the object to string.

var d = new Date();
alert(d.toLocaleString());
alert(d.getDate());
alert(d.getUTCDate());
alert(d.toUTCString();

There’s a good list of things to try here: Date - JavaScript | MDN

As far as why this might be the case, I would put it down to using an ancient fork of Mozilla’s JavaScript engine from back when Freeway 2 was a thing. I don’t know how or how much it’s been updated since that epoch, but as far as I know, that’s the Genesis of JavaScript in Actions.


FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes, I get the correct date and time and zone. I think the problem is on your Mac.

Walter

On Jun 15, 2012, at 1:33 PM, Tim Plumb wrote:

Thanks for the input here.

The date object in Freeway still wants me to believe that the date is Monday June 11th 2012 (rather than Friday June 15th).

Jeremy, the Current Date Action works because all of the date manipulation is done in the browser rather than in Freeway. For the moment I’ve got a timestamp from Terminal which works perfectly fine with the only downside being the Action needs AppleScript enabled to run.

Walter, do you get the correct date if you run this Action?

<page-action>
<action-javascript>
	function fwAfterEndBody(){
		alert(new Date());
	}
</action-javascript>
</page-action>

I’m wondering if I’ve somehow managed to mangle Freeway’s internal timezone or offsets over the years.
Regards,
Tim.

On 15 Jun 2012, at 17:16, Walter Lee Davis wrote:

Does anything change if you set the date to a variable first, and alert the variable? I’m thinking it may be an order of operation thing. Also, look at any of the accessors in the Date object, rather than just relying on the default that comes when you cast the object to string.

var d = new Date();
alert(d.toLocaleString());
alert(d.getDate());
alert(d.getUTCDate());
alert(d.toUTCString();

There’s a good list of things to try here: Date - JavaScript | MDN

As far as why this might be the case, I would put it down to using an ancient fork of Mozilla’s JavaScript engine from back when Freeway 2 was a thing. I don’t know how or how much it’s been updated since that epoch, but as far as I know, that’s the Genesis of JavaScript in Actions.


FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yep, there is something wrong but as far as I can see it only seems to be an issue in Freeway. All the browsers I run that code through tell me the correct date.
There’s going to be something somewhere that I’ve kicked out of shape in the past (a timezone offset setting or something) but finding it could be an uphill struggle.
Thanks for checking Walter.
Regards,
Tim.

On 15 Jun 2012, at 18:47, Walter Lee Davis wrote:

Yes, I get the correct date and time and zone. I think the problem is on your Mac.


FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well I just zapped Freeway’s prefs file and I’m now back in the present. Now I just need to set the palette positions back to where they belong. :slight_smile:
Regards,
Tim.

FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options