Skip to content

Commit 836d738

Browse files
authored
Merge pull request #1 from onneri/feature/date-format-string-support
adding date format names supporting
2 parents 12b53a4 + 8aa021c commit 836d738

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/js/angular-datepicker.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,33 @@
303303
return item.length > 0;
304304
});
305305

306+
switch(dateFormatDefinition){
307+
case 'medium':
308+
dateFormatDefinition = 'MMM d, y h:mm:ss a';
309+
break;
310+
case 'short':
311+
dateFormatDefinition = 'M/d/yy h:mm a';
312+
break;
313+
case 'fullDate':
314+
dateFormatDefinition = 'EEEE, MMMM d, y';
315+
break;
316+
case 'longDate':
317+
dateFormatDefinition = 'MMMM d, y';
318+
break;
319+
case 'mediumDate':
320+
dateFormatDefinition = 'MMM d, y';
321+
break;
322+
case 'shortDate':
323+
dateFormatDefinition = 'M/d/yy';
324+
break;
325+
case 'mediumTime':
326+
dateFormatDefinition = 'h:mm:ss a';
327+
break;
328+
case 'shortTime':
329+
dateFormatDefinition = 'h:mm a';
330+
break;
331+
}
332+
306333
formatDate = dateFormatDefinition
307334
.match(formattingTokens)
308335
.filter(function fromatDateFilter(item) {

0 commit comments

Comments
 (0)