PageSourceSearch

http://www.beloga.xyz/dayjs-1.11.7/esm/plugin/quarterOfYear/index.js

js beloga.xyz collected 2026-09-29 03:23:52 UTC 1,046 bytes, 41 lines download raw bytes

vendor: 1,046 bytes, lines 1-41
1import { Q, M, D } from '../../constant';
2export default (function (o, c) {
3  var proto = c.prototype;
4
5  proto.quarter = function (quarter) {
6    if (!this.$utils().u(quarter)) {
7      return this.month(this.month() % 3 + (quarter - 1) * 3);
8    }
9
10    return Math.ceil((this.month() + 1) / 3);
11  };
12
13  var oldAdd = proto.add;
14
15  proto.add = function (number, units) {
16    number = Number(number); // eslint-disable-line no-param-reassign
17
18    var unit = this.$utils().p(units);
19
20    if (unit === Q) {
21      return this.add(number * 3, M);
22    }
23
24    return oldAdd.bind(this)(number, units);
25  };
26
27  var oldStartOf = proto.startOf;
28
29  proto.startOf = function (units, startOf) {
30    var utils = this.$utils();
31    var isStartOf = !utils.u(startOf) ? startOf : true;
32    var unit = utils.p(units);
33
34    if (unit === Q) {
35      var quarter = this.quarter() - 1;
36      return isStartOf ? this.month(quarter * 3).startOf(M).startOf(D) : this.month(quarter * 3 + 2).endOf(M).endOf(D);
37    }
38
39    return oldStartOf.bind(this)(units, startOf);
40  };
41});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.