I’m trying to indicate if a business is open given the current time of day, an open time, and a close time. Here’s my time format.
$scope.open = "1970-01-01T13:00:00.000Z"; // We can ignore the dates
$scope.close = "1970-01-02T22:00:00.000Z"
Is there a simple & surefire way to determine this in Angularjs? Something like
<div ng-if="currentTime >= open && currentTime < close"></div>
I have found several moment libraries that could possibly handle this, but I feel like importing a whole library is overkill for a basic time comparison, and most of the javascript solutions I’ve come across don’t handle this time format.
Any input is appreciated!
Source: AngularJS
from Angular Questions https://angularquestions.com/2017/10/22/check-if-current-time-is-between-opening-close-times-with-angularjs/
via @lzomedia #developer #freelance #web #lzomedia.com
No comments:
Post a Comment