1
Answer

What are functions replaced with in Typescript ?

mel_lisau

mel_lisau

7y
320
1
Hi ,
I am migrating code from Javascript to TypeScript 
 
I have the following
 
function myDateDialog()
{
var retDay;
var retMonth;
var retYear;
}
function openDatePickerDialog(wnd, field, dateFormat) {
myDateDialog.retDay = "";
myDateDialog.retMonth = "";
myDateDialog.retYear = "";
var dlgURL = '../DatePicker.htm';
field.value = dateFormat.replace(/yyyy/, myDateDialog.retYear).replace(/MM/, myDateDialog.retMonth).replace(/dd/, myDateDialog.retDay);
 
what would be the best to replace the Javascript code  
function myDateDialog() , would a class be best and declare  retDay , retMonth and retYear as properties ?
 
Then instantiate the class in  openDatePickerDialog and set the properties values ?
 
or is there a better approach ?
  
Thanks
 
 

Answers (1)