Answer the question
In order to leave comments, you need to log in
Time intervals from 8 to 18 every day OOP?
We set the current day at 8:00 am and output + 6 days.
Every day starts at 8:00 and ends at 18:00
$begin = new DateTime("now");
$begin->setTime(08, 00, 00);
$end = new DateTime("now");
$end->setTime(18, 00, 00);
$end = $end->modify("+6 day 1 second");
$interval = new DateInterval('PT1H');
$daterange = new DatePeriod($begin, $interval ,$end);
foreach($daterange as $date){
if( strtotime($date->format("H:i:s")) >= strtotime("08:00:00") &&
strtotime($date->format("H:i:s")) <= strtotime("18:00:00") ) {
echo $date->format("Y-m-d H:i:s") . "<br>";
}
}
if( strtotime($date->format("H:i:s")) >= strtotime("08:00:00") &&
strtotime($date->format("H:i:s")) <= strtotime("18:00:00") )
Answer the question
In order to leave comments, you need to log in
Errors in the console look like links for a reason. Have you tried following it?
Some problem with the $posts provider.
Notice if you have a global variable posts?
Well, it seems to be swearing at $posts that there is no provider for this name in $injector.
Option 1. You do not have any service or other with this name in Angular at the time of transition to this state.
Option 2: You are using ui-router. If you use resolve in state configs, then it may simply be that this (or its parent) state does not have such a variable that you are trying to get using DI.
$stpr.state('someState', {
url: '/someUrl',
....
resolve: {
$posts : //достаём посты. $http или ещё как-то
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question