mel_lisau

mel_lisau

  • NA
  • 169
  • 0

What are functions replaced with in Typescript ?

May 2 2017 12:43 AM
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)