Xporter - a mistake on Confluence "Javascript" page

Alexandra Skripacheva August 30, 2017

Good day everyone!

Found out that the https://confluence.xpand-addons.com/display/public/XPORTER/Javascript :

%{var months =  new Array( 'Jan' ,  'Feb' ,  'Mar' ,  'Apr' ,  'May' ,  'Jun' ,  'Jul' ,  'Aug' ,  'Sep' ,  'Oct' ,  'Nov' ,  'Dec' ); var dateParts
 = '${dateformat("d-MMM-yyyy HH:mm:ss}'.split( '-' ); var month = dateParts[ 1 ]; var year = dateParts[ 0 ] ; var day = dateParts[ 2 ].split( ' ' )[ 0 ];
 months[Number(month) -  1 ] +  ' ' + day +  ', ' + year;}

doesn't work on the Word templates. Can anyone help to create the correct Javascript for this case? Unfortunately I can't use the standart date-format (MMM) because I need the Rus names of months using the English JIRA version 

Thanks in advance! 

1 answer

1 accepted

0 votes
Answer accepted
Alexandra Skripacheva August 31, 2017

ok, the solution was found:

%{var months = new Array('января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря'); var dateParts = '${CreatedTime}'.split('-'); var month = dateParts[1]; var day = dateParts[0] ; var year = dateParts[2].split(' ')[0]; '«' + day + '» ' +  months[parseInt(month) - 1]  + ' ' + year + ' г.';}

it would be great to correct the mistake in the documentation.

Have a nice day!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events