nolabel
nolabel

Reputation: 1157

Angular Bootstrap: How to Allow 2 different date format

I am trying to allow MM/dd/YYYY or M/d/YYYY.

Or this pattern:

Upvotes: 5

Views: 1925

Answers (2)

Ursin Brunner
Ursin Brunner

Reputation: 2430

Seems that the issue has been fixed with this commit. You can now define a day/month/year-date in format d!.M!.yyyy. It allows an optional leading zero for day and month. See this github-issue for more information.

Available as NPM (angular-ui-bootstrap) from V1.0.

Upvotes: 7

icfantv
icfantv

Reputation: 4643

Per the Angular UI Bootstrap datepicker documentation, the directive uses the date filter built into angular core (documentation here).

Based on the formatting you desire, you want MM for format-month attribute and dd for the format-day attribute.

Upvotes: 1

Related Questions