Jump to content

jimfog

Members
  • Posts

    1,803
  • Joined

  • Last visited

Everything posted by jimfog

  1. As far as I know dependencies are files/plugins which the developer imports in a js file with script tags. I am reading an article about depedencies here: http://krasimirtsonev.com/blog/article/Dependency-injection-in-JavaScript The writer begins with an example with functions. I really cannot understand it... Are functions used instead of script tags?
  2. Ι have fixed it.Thanks anyway.
  3. I have created this jsbin code example http://jsbin.com/dajis/4/ But despite the fact I have included backbone in the head section,this is not recognized as I see in the Dev tools console(an error message appears there). Why this might be happening?
  4. jimfog

    loop creation

    Yes,you are right. I had tried it but the implementation/logic was wrong-I tried now a different logic and it worked. Probably,creating a topic about it,was not even necessary.
  5. I have created a loop that creates a dropdown menu, a menu of timestamps, for reasons of clarity though I have created this fiddle http://jsfiddle.net/fiddlehunt/5WVKz/ where the menu is comprised of numbers 1-10, And here is the problem: As you will see in the fiddle the append() method is used. The problem is that whenever the function that creates the loop gets called...the created numbers are added to the numbers that where created with the previous function call. So. when the menu is opened(and if for example the function has been called twice) I see two times 1-10. Unfortunately I cannot replicate the behavior with jsfiddle. How can I fix it?
  6. Yes,that will do.Actually I had resort to this solution even before I see your post.
  7. I have concluded to this code: var minutes= j.getMinutes();var adjminuts = (minutes === 0) ? 00 : minutes; The problem though is that when minutes === 0,adjminutes takes always the value 0,not 00 as I want to. WHat can I do here? It seems that JS,when we have a number comprised of many zeros,than js will just print 0 in the browser.
  8. I have made a considerable progress in the direction I wish. I have one small question though. I use getMinutes to "grab" the minutes of a given timestamp. Suppose we have 10:00-getMinutes will output 0,I want 00 though. What can I do? Add the second O my self with custom code?
  9. I will look into the library you mentioned. For now I have managed to do what I want...take a look at this fiddle: http://jsfiddle.net/fiddlehunt/ZP74r/ It might be convenient to make calculation when working with timestamps but I do not know if it is possible to set the hour/minute(as shown in the fiddle) with these. It is possible to set hour/min with UNIX timestamps-my fault I did not saw it earlier.
  10. You are right...let me do some testing on my own and I will get back...if necessary.
  11. The above being said is it correct to assume I must set the "pretty date" at the beginning of the day. I mean whatever calculation needs to be done must be done on the "pretty date",not in the UNIX timetamp.
  12. So,,,in other words...you are saying to convert the timestamp into time format like the above and then use this in the date constructor...which in turn will give a new timestamp(modified).
  13. I do not understand how will this help in my case. Can you be more specific?
  14. Is there any js method to alter a UNIX timestamp? All theses set methods seem not to have any effect on timestamps per se. Suppose I have 1402376400. How I can set it to 1402376100.... I can use simple arithmetic of course to do my job....but these would require some extra calculations. The goal is this: Given a timestamp...set the time in the beginning of the day. Suppose I have in UNIX timestamp form this date: Tue, 10 Jun 2014 17:34:53 GMT I want to convert it to this:Tue, 10 Jun 2014 01:00:00 GMT Is there a js code/method available to help in this direction? One issue(important to consider) is that the given timestamp varies and no standard calculation would be appropriate here,That is why I was asking if a js method existed for that.
  15. Τhat wont'be necessary cause I use 2 menus,one for the start date and the other for the end date.Just go and see the fiddle.
  16. No....the dropdown option values(timestamps) must span all the 24h. The start/end dates I mention are selected by the user when clicking in the calendar...at that point a dialog box appears with selected dates depicted in two dropdown menus. The user though...might decide to choose other dates from the menus...just like in outlook.com calendar. Here is the fiddle http://jsfiddle.net/fiddlehunt/5xsxP/...go to weekview and click a slot to see the dialog box...see the HTML also...
  17. No...I do not have an array...but I still think a loop is needed There is a misunderstanding here.The start and end date are not the start and end of the 24h period as the dropdown option values must cover but the start and end of an event...that can be 10:00 to 11:00 for example.
  18. Yes...what you describe above is what I want to achieve. Now to the problem itself. I have one piece of data...a specific point in time(the specific timestamp)...I do not know how to use that and construct the loop-that is the problem. It might simple to you but not to me.I am trying to find a solution to it myself too.
  19. Ι do understand the logic but I am having difficulty implementing it. So far I have concluded that the first step will be this: var inmilise=1401840000*1000;//this is a timestamp multiplied by 1000... var d = new Date(inmilise); The above prints a date...in this specific example it is this: 6/4/2014 3:00:00 AM The above info must somehow be used in the loop...but the question is how specifically I must do this?
  20. And this is the point where I am stuck,
  21. Dividing by 1000 will fix this.That is not the problem here.
  22. Yes,you are correct. Timestamps for the whole 24h-and always based on a specific day/month.The one the user clicked. The already present timestamps I suppose can help somehow-revealing some info about the day/month.
  23. well...I just made some progress.In JS,I maybe able to pull this off with JS,it might not be necessary to resort to PHP. The first obstacle to create the dropdown menu is to get UNIX timestamps. Now, I managed to get the timestamps(start/end date of an event,it's duration in other words). So this is the first step. Now,,,,having these new data,how I could proceed and construct the dropdown? The point being is that after the popup appears(with the selected dates) the user will be able to alter the start/end dates.just like in outlook.com calendar. In other words....by having 2 timestamps is it possible to construct the other timestamps that will correspond to different times-there must be 30min intervals? And these(of course) newly constructed timestamps will be placed in the option values of the menu. Can JS help in the above?
  24. well...I decided to post in this forum cause the application uses backbone to send event data to the server(that includes the timestamp). I am going to post in the PHP forum cause I thing the HTML rendering(the dropdown menu with the timestamps) must be PHP's job. It is a thought I just made and the future will tell if it is the correct solution. I agree of course that the dropdown menus must be unix timestamps.
  25. You are saying "to convert a string to a date object". To be honest I do not know if that is even necessary. Let me describe the problem again.I want to build a dropdown menu of times where each one will correspond to a different timestamp(and this will be depicted in the option value of the menu option selected.) First of all I do not know if this must be done with JS or PHP...that is another issue to consider also.
×
×
  • Create New...