JavaScript Ionic - How I get the date from next week? ionic date from string,ionic date to string format,ionic

I want to get today's date + 7 days. Today I get with public dateToday: string = new Date().toLocaleDateString('de-DE');

On Google I found this:

this.dateOneWeek.setDate(this.dateOneWeek.getDate() + 7);

But it doesn´t work, the function setDate() and getDate() doesn´t exist.

So how I can solve the Problem?

Answer:1

You can try as below:

public dateOneWeek: string = new Date((new Date().setDate(new Date().getDate() + 7))).toLocaleDateString('de-DE');

Or for simplicity you should do as follow:

var date = new Date();
date.setDate(date.getDate() + 7);

var dateOneWeek= date.toLocaleDateString('de-DE');
console.log(dateOneWeek);
Answer:2

Hard to tell without seeing where you're declaring your dateOneWeek variable.

Provided you initialize your dateOneWeek variable with a Date datatype, you should be able.

var dateOneWeek = new Date();
dateOneWeek.setDate(dateOneWeek.getDate() + 7);

If you are working with strings you are doing in:

public dateToday: string = new Date().toLocaleDateString('de-DE');

Adding 7 won't make a difference since it's in a string format.

Answer:3

I have a weird issue with ngAnimate in a simple application I'm doing with the MEAN Stack. Both angular.js and angular-animate.js are 1.4.7 version. I have an ul that looks something like this: &...

I have a weird issue with ngAnimate in a simple application I'm doing with the MEAN Stack. Both angular.js and angular-animate.js are 1.4.7 version. I have an ul that looks something like this: &...

  1. angularjs animate list
  2. angular animation list
  3. angular animation list items
  4. angular list animation example

I am new to PWA and I am stuck on one task. Here is my manifest.json file which helps to display add to home screen popup to android device. { "short_name": "The Cozy", "name": "The Cozy", "...

I am new to PWA and I am stuck on one task. Here is my manifest.json file which helps to display add to home screen popup to android device. { "short_name": "The Cozy", "name": "The Cozy", "...

  1. show home screen after face id
  2. show home screen icon badge
  3. show home screen iphone
  4. show home screen
  5. show home screen android
  6. show home screen mac
  7. show home screen when all documents are closed
  8. show home screen windows 10
  9. show home screen in excel
  10. show home screen clock
  11. show home screen ios
  12. echo show home screen
  13. alexa show home screen
  14. alexa show home screen options
  15. show me home screen
  16. echo show home screen slideshow
  17. show my home screen
  18. echo show home screen options
  19. amazon show home screen
  20. echo show home screen background

I have three buttons which clone a div and it will show the div before the clicked button. Currently when clicking on a button, the div will appear before all three buttons. I need on click of the ...

I have three buttons which clone a div and it will show the div before the clicked button. Currently when clicking on a button, the div will appear before all three buttons. I need on click of the ...

I have a simple 3 part horizontal bar chart like so: You can check it out on CodeSandbox or try out the code: function App() { return ( <VictoryStack colorScale={['#D0021B', '#F5A623', '#...

I have a simple 3 part horizontal bar chart like so: You can check it out on CodeSandbox or try out the code: function App() { return ( <VictoryStack colorScale={['#D0021B', '#F5A623', '#...