Blame view

天文台pc/tianwentai-ui/node_modules/date-fns/parse/_lib/Setter.js 1.21 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  "use strict";
  exports.ValueSetter =
    exports.Setter =
    exports.DateToSystemTimezoneSetter =
      void 0;
  var _index = require("../../transpose.js");
  var _index2 = require("../../constructFrom.js");
  
  const TIMEZONE_UNIT_PRIORITY = 10;
  
  class Setter {
    subPriority = 0;
  
    validate(_utcDate, _options) {
      return true;
    }
  }
  exports.Setter = Setter;
  
  class ValueSetter extends Setter {
    constructor(
      value,
  
      validateValue,
  
      setValue,
  
      priority,
      subPriority,
    ) {
      super();
      this.value = value;
      this.validateValue = validateValue;
      this.setValue = setValue;
      this.priority = priority;
      if (subPriority) {
        this.subPriority = subPriority;
      }
    }
  
    validate(date, options) {
      return this.validateValue(date, this.value, options);
    }
  
    set(date, flags, options) {
      return this.setValue(date, flags, this.value, options);
    }
  }
  exports.ValueSetter = ValueSetter;
  
  class DateToSystemTimezoneSetter extends Setter {
    priority = TIMEZONE_UNIT_PRIORITY;
    subPriority = -1;
    set(date, flags) {
      if (flags.timestampIsSet) return date;
      return (0, _index2.constructFrom)(date, (0, _index.transpose)(date, Date));
    }
  }
  exports.DateToSystemTimezoneSetter = DateToSystemTimezoneSetter;