UNPKG

zeller-date

Version:

A simple implementation of Zeller's congruence to compute day of the week

2 lines (1 loc) 313 B
function e(n,o,t){o<3&&(o+=12,t-=1);let a=n,c=o,s=t%100,r=Math.floor(t/100);return(a+Math.floor(13*(c+1)/5)+s+Math.floor(s/4)+Math.floor(r/4)+5*r)%7}var d=["Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"];function f(n,o,t){let a=e(n,o,t);return d[a]}module.exports={zeller:e,getDayName:f};