how to push correct time from input textbox in angularjs - angularjs

i want to push time in my database but when i push time my $scope.moreadditems variable its save wrong time please help me i am using angularjs
check when i enter time 9:00 AM why this show different time
check jsfiddle
i am adding below time its working fine add in table
but when i click show details its show different time
and also this time in database why

input[time] will always output datetime of 1970-01-01 + the time you inputed, see documentation here.
If you just want to keep the time part, you can use filter date to pick it, and don't forget to inject $filter first.
var timeHHMM = $filter('date')(time, 'hh:mm');
refer demo.

Related

Arshaw full calendar does not show time properly

I am using Arshaw full calendar[Angular bootstrap] in my project, but after implementing it, Whenever I go to the day view and click on the time span say 12.00am, day click event gets fired and if I extract date from the view object I get the same date but the timing shows 05.30.0, That means there is difference of 5.30 hours... Why is this happening, I am using the latest version of master calendar. I am sharing the snapshot of the same. Please help, Thank you..!!!

Angular datepicker using Bootstrap

When we select a date from the angular Datepicker and my model is empty first time, then it selects one day back date.
If we assign current date first time in the model, then it works fine.
Check here
and here
It seems that in both, changing the date format seemed to fix the problem.
Also, welcome to Stack Overflow :)

Google Spreadsheet - now() function update with web embedded link only

I'm running a spreadsheet which is using a now() function for a countdown delta.
I want the embedded spreadsheet on my webpage to update the now() function whithout accessing the spreadsheet.
The time triggers that I tried always require a user to load or edit the spreadsheet before it is updating. Even in "File/Settings" changing it to on change and every minute is not helping.
Any ideas?
Why not use the time trigger to update the cell?
function updateTime(){
SpreadsheetApp.openById(ssid).getSheets()[0].getRange('G10').setValue(new Date());
}
As Zig Mandel commented, a much simpler way would be to go into "Spreadsheet settings..." and change "Recalculation" to Every hour or minute.

How to add year/months/day to a current date using angularJS

I am new to angularJS and now i would like to how to add the year from current date.
Let's say i can get the user DOB and i want to add the year+1.
I have tried by using,
$scope.userdob = $rootScope.user.dob;
$scope.userdob.add(1,'years');
but it's not working.
Can anyone help me to know about this logic with example ?
TIA..,
You should use .setDate() function to increment the days.
I created an angular example here http://codepen.io/heshamelghandour/pen/WwodMP
It looks like $rootScope.user.dob is an instance of moment from the moment.js library. I think your main problem is angular's change detection cannot detect when you mutate this instance. Because the instance remains the same but the internal underlying date value does change. Thus I'd suggest:
$scope.userdob = $rootScope.user.dob.clone().add(1,'years').valueOf();
That way angular will get a regular JavaScript Date object instead of a moment instance and it's change detection will work correctly.
FYI to accomplish the same with a standard javascript Date instance you can do:
var userdob = new Date();
userdob.setYear(userdob.getFullYear() + 1)
To advance the year by 1.
Use .setDate() function to increment the days and instead of +1 day and add +365 days it will give you date after 1 year.

AngularJS - Is it possible to show data in a specific time range?

hope someone can help me with this question.
I have an entity which contains a start time (let's say 15 o'clock) and an end time (let's say 16
o'clock). It also contains the date (let's say today^^).
So my query returns all data of today, but I only want to show the data between 15 and 16 o'clock.
Do I need to set a $timeout for each object? Or is it possible to automatically call a method called shouldShowData which used in ng-show?
Basically I have a list of objects and want to show single object just on a specific time of the day.
EDIT
Imagine that the screen is shown in a public place and displays different news at different time (morning news, evening news, ...) and should automatically update when the specific news should be displayed based on it's start and end time. It can't be updated manually with a refresh button for example.
Great to here from you :)
I have found similar problem and solution for it here
All you need is to wrap this into $filter and use on ng-repeat.

Resources