const fnDate = () => { const date = new Date(); const year = date.getFullYear(); const month = date.getMonth(); const time=year+"-"+fnW((month)); return time; } const fnW = (str) => { var num; str > 9 ? num = str : num = "0" + str; return num; }