Page 1 of 1
Weekly updating image or menu
Posted: Mon Jul 15, 2013 4:31 pm
by sam5863015
I have created a HTML5 app and I'd like to add a message box or image that displays a message but automatically updates each week at midnight, the text will only say "service week (number)" is there any way I can do this?
Weekly updating image or menu
Posted: Mon Jul 15, 2013 5:00 pm
by maxkatz
You probably can.. but you would need to write some custom JavaScript to implement this feature.
Weekly updating image or menu
Posted: Mon Jul 15, 2013 5:03 pm
by sam5863015
Any idea how to do this any tutorials to follow I've never wrote any code
Weekly updating image or menu
Posted: Mon Jul 15, 2013 5:11 pm
by Kateryna Grynko
Hi Sam,
http://docs.appery.io/tutorials/ you can try our tutorials here
Weekly updating image or menu
Posted: Mon Jul 15, 2013 5:11 pm
by maxkatz
Sorry, we don't have a tutorial for that.. this is custom app logic. You need to have good experience with JavaScript to add such feature.
Weekly updating image or menu
Posted: Mon Jul 15, 2013 6:25 pm
by Kateryna Grynko
Hi Sam,
The following function is a part of jQuery.Datepicker component code:
precodeiso8601Week: function(date) {
date = date || new Date();
var time,
checkDate = new Date(date.getTime());
Code: Select all
// Find Thursday of this week starting on Monday
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
time = checkDate.getTime();
checkDate.setMonth(0); // Compare with Jan 1
checkDate.setDate(1);
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
}/code/pre
Add this code as JavaScript asset and call it when you need to get number of current week. You can also pass needed date to find out what week it is.
Weekly updating image or menu
Posted: Mon Jul 15, 2013 7:49 pm
by sam5863015
Thank you for your help ill try it out later 