Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Bootstrap: How to Allow 2 different date format

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

Or this pattern:

  • 02/04/1998
  • 02/4/1998
  • 2/04/1998
  • 2/4/1998
like image 389
nolabel Avatar asked Sep 28 '15 21:09

nolabel


People also ask

How to change the datetime format in angular?

To change the datetime format in angular we have to pass date time format parameter to the angular pipe as shown below. { { date_value | date :'short'}} // 6/15/19, 5:24 PM. The format ‘short’ is one of the predefined date formats in angular which converts our date value to ’M/d/yy, h:mm a’ format.

What is the angular bootstrap datepicker?

The angular bootstrap datepicker is an advanced feature for picking the date in web applications. It is choosing the date, month, and year as per user’s requirements. We can able to pick the date range from start to end dates. It allows choosing the local language in datepicker and change the color of the calendar.

What is the use of bootstrap in angular?

The bootstrap has many advanced components and classes to make application user friendly. The angular make reduces the size of code in a one-page format to make web application lightweight. The combination of angular and bootstrap for date picker is useful and easy for users and developers.

What is the use of angular make in date picking?

The angular make reduces the size of code in a one-page format to make web application lightweight. The combination of angular and bootstrap for date picker is useful and easy for users and developers.


Video Answer


2 Answers

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.

like image 81
Ursin Brunner Avatar answered Sep 29 '22 08:09

Ursin Brunner


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.

like image 43
icfantv Avatar answered Sep 29 '22 09:09

icfantv