Skip to content

Instantly share code, notes, and snippets.

@egoist
Created December 25, 2014 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egoist/d8efd0aa50220d02cc54 to your computer and use it in GitHub Desktop.
Save egoist/d8efd0aa50220d02cc54 to your computer and use it in GitHub Desktop.
function getTitle(weekday){
var t = new Date();
t = t.getDay();
var title = '';
switch(weekday){
case 1:
title = '周一';
break;
case 2:
title = '周二';
break;
case 3:
title = '周三';
break;
case 4:
title = '周四';
break;
case 5:
title = '周五';
break;
case 6:
title = '周六';
break;
case 7:
title = '周日';
break;
}
if(weekday = t) title += '<small>今天</small>';
if(weekday = t-1) title += '<small>昨天</small>';
if(weekday = t-2) title += '<small>前天</small>';
if(weekday = t+1) title += '<small>明天</small>';
if(weekday = t+2) title += '<small>后天</small>';
return title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment