-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Bug, feature request, or proposal:
proposal: returning month in a more useful format
What is the expected behavior?
returns '2017-03' instead of
What is the current behavior?
start=2017-03-01 0h0m0s local time
end= 2017-03-31 23h59m59s local time
What are the steps to reproduce?
switch to month mode and choose a month
Providing a Plunker (or similar) is the best way to get the team to see your issue.
Plunker template: http://plnkr.co/edit/o077B6uEiiIgkC0S06dd
What is the use-case or motivation for changing an existing behavior?
for easier extracting month/year of the selected month. Start/End is tricky, because ISO-STRING uses GMT and either start/end can easily move to previous/next month.
Which versions of Angular, Material, OS, browsers are affected?
any
Is there anything else we should know?
suggested code:
newPeriod = {
type: 'month',
startDate: new Date(momentConstructor(entry.date).startOf('month').toDate().valueOf()),
endDate: new Date(momentConstructor(entry.date).endOf('month').toDate().valueOf())
};
// add a new @output() selMonth:
let sd = new Date(entry.date.valueOf() - entry.date.getTimezoneOffset()*60000);
this.selMonth.emit(sd.toISOString().substr(0,7));
Metadata
Metadata
Assignees
Labels
No labels