Issue
I want to show the remaining months of current year and remove the past months from current month in ionic angular or javascript. Here is my code:
month = ['January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'];
currentMonth = this.month[new Date().getMonth()];
Solution
You can use slice
const month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
const d = new Date();
const rest = month.slice(d.getMonth())
console.log(rest)
Answered By - mplungjan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.