sam5863015
Posts: 0
Joined: Thu May 16, 2013 5:50 pm

Weekly updating image or menu

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?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Weekly updating image or menu

You probably can.. but you would need to write some custom JavaScript to implement this feature.

sam5863015
Posts: 0
Joined: Thu May 16, 2013 5:50 pm

Weekly updating image or menu

Any idea how to do this any tutorials to follow I've never wrote any code

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Weekly updating image or menu

Hi Sam,

http://docs.appery.io/tutorials/ you can try our tutorials here

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Weekly updating image or menu

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Weekly updating image or menu

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.

sam5863015
Posts: 0
Joined: Thu May 16, 2013 5:50 pm

Weekly updating image or menu

Thank you for your help ill try it out later :-)

Return to “Issues”