11

I am trying to create a date object of javascript to store current date and time

let now:Date = new Date(); 

But the below line show error in my intellij as the below error:

TS2304:Cannot find name 'Date'.

I am guessing as Date is javascript object and new Date() is not available in typescript or in my project, its failing.

I am writing angularjs 1.5.9 in typescript, I dont thing is anything related to angularjs.

How to fix this?

0

2 Answers 2

16

Step 1. Simply click on the version displayed in the footer of your visual studio code.

Step 2. Then choose Use Workspace version.

You will be good to go.

Sign up to request clarification or add additional context in comments.

1 Comment

-4

try thisvar today = new Date()

1 Comment

Please add an explanation so we can understand what you mean by this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.