Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bennewton999
Created July 13, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennewton999/d93600b99de5aad8a2b1 to your computer and use it in GitHub Desktop.
Save bennewton999/d93600b99de5aad8a2b1 to your computer and use it in GitHub Desktop.
Simple responsive date for AngularJS
<span>{{fare.book_by_date | date:checkDate()}}</span>
$scope.checkDate = function() {
console.log($window.innerWidth);
if ($window.innerWidth > 1024) {
return 'longDate';
} else {
return 'shortDate';
}
};
@cdvillard
Copy link

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.

@bennewton999
Copy link
Author

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