Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

md-datepicker sending the day before the one that I select #8936

@JulioJu

Description

@JulioJu

Hello

I've seen closed issue #4636 named « md-datepicker sending the day before the one that I select ».

@jadjoubran, @jelbourn and @altsel, maybe I have an other solution closer of https://material.angularjs.org/1.0.9/api/service/$mdDateLocaleProvider. Maybe it's better than @altsel solution (11 Nov 2015) , because it uses $mdDateLocaleProvider.formatDate

        $mdDateLocaleProvider.formatDate = function(date) {
            var m = moment(date);
            if (!m.isValid()) {
                return '';
            }
            var dateView = moment(date).format('X'), // return unix timestamp of `date' argument
            dateCurrentScript = moment().format('X'); // return current unix timestamp
            if (dateView + 1 > dateCurrentScript )
                return '';
            else
                return m.format('L');
        };

What do you think about that (maybe my code is totally stupid, (sorry)) ?

If you think this solution is good, maybe we can add it in https://github.com/angular/material/issues/4636 ? But for that, we must ask to @ThomasBurleson or an other AngularMaterial collaborator to unlock #4636 conversation.

Julio

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions