Created
July 13, 2015 16:29
-
-
Save bennewton999/d93600b99de5aad8a2b1 to your computer and use it in GitHub Desktop.
Simple responsive date for AngularJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span>{{fare.book_by_date | date:checkDate()}}</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.checkDate = function() { | |
console.log($window.innerWidth); | |
if ($window.innerWidth > 1024) { | |
return 'longDate'; | |
} else { | |
return 'shortDate'; | |
} | |
}; |
sure, the break point can be whatever you want.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I like it, but I think the breakpoint could stand to be smaller. I don't know too many tablets that couldn't handle a long date format, or too many mobile devices with a screen as big as 1024px wide.