Skip to content
This repository has been archived by the owner on Jul 31, 2020. It is now read-only.

Will Datejs work with JavaScript for Automation (JXA)? #74

Open
JMichaelTX opened this issue Dec 22, 2015 · 1 comment
Open

Will Datejs work with JavaScript for Automation (JXA)? #74

JMichaelTX opened this issue Dec 22, 2015 · 1 comment

Comments

@JMichaelTX
Copy link

Hi. I just found this great library, and it looks awesome!
It runs fine, testing with Chrome JavaScript console.

But I can't get it to work with JXA.

I get this error:
image

When running this code:

var app = Application.currentApplication()
app.includeStandardAdditions = true

Date.today();

/**
 * @version: 1.0 Alpha-1
 * @author: Coolite Inc. http://www.coolite.com/
 * @date: 2008-05-13
 * @copyright: Copyright (c) 2006-2008, Coolite Inc. (http://www.coolite.com/). All rights reserved.
 * @license: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
 * @website: http://www.datejs.com/
 */
Date.CultureInfo={name:"en-US",englishName:"English (United 

The code from the entire Date-en-US.js file is at the bottom of my Script Editor file, I just cut off the code when I pasted it here.

Same file runs fine in a simple HTML page using Chrome JavaScript console.

Any suggestions as to how I can make this work with JXA?

TIA.

@martinschilliger
Copy link

I don't know much about JXA, but maybe it's a problem related to Datejs expanding the native Date()-function? Is this allowed in JXA? I didn't found out with a quick Google search.

According to http://www.automatedworkflows.com/2014/10/28/whats-new-with-automation-in-yosemite/:

JXA can access Objective-C and Cocoa frameworks

you may use the native Date-Framework of Mac OS X as an alternative?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants