TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Hakan Axheim
NA
201
32.1k
Extraction data from a Array to another wit filter
Nov 8 2017 9:11 AM
Hi,
I have some problem with my source code. It looks like this!
const currentDate = moment().format('MM/DD/YYYY'); // Current Date
this.bookingsData = this.bookingsService.bookings;
this.bookingsDataFuture = this.bookingsData.filter(r => moment(r.periodEnd).format('MM/DD/YYYY') >= currentDate);
this.bookingsDataPast = this.bookingsData.filter(r => moment(r.periodEnd).format('MM/DD/YYYY') < currentDate);
In bookingsData I have three rows of appointments. All three in the future!
In bookingsDataFuture I want all bookings made in the future from current date.
In bookingsDataPast I want all bookings that have been in the past.
Unfortunately only thow rows will be in the future and one of them in the past.
All three rows should be in the future.
This is my testdata and the result of the source code:
11/15/2017 (Future)
11/16/2017 (Future)
11/17/2017 (Past)
Reply
Answers (
1
)
Asp.net MVC with angularjs - nested repeater
Angular 2 coding standards