index.js 360 B

12345678910111213141516171819
  1. export default (function (o, c) {
  2. var proto = c.prototype;
  3. proto.weekYear = function () {
  4. var month = this.month();
  5. var weekOfYear = this.week();
  6. var year = this.year();
  7. if (weekOfYear === 1 && month === 11) {
  8. return year + 1;
  9. }
  10. if (month === 0 && weekOfYear >= 52) {
  11. return year - 1;
  12. }
  13. return year;
  14. };
  15. });