@douyinfe/semi-foundation 2.31.3-alpha.1 → 2.31.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -268,6 +268,18 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
268
268
  }
269
269
  }
270
270
 
271
+ /**
272
+ * value 可能是 UTC value 也可能是 zoned value
273
+ *
274
+ * UTC value -> 受控传入的 value
275
+ *
276
+ * zoned value -> statue.value,保存的是当前计算机时区下选择的日期
277
+ *
278
+ * 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
279
+ *
280
+ * 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
281
+ *
282
+ */
271
283
  parseWithTimezone(value: ValueType, timeZone: string | number, prevTimeZone: string | number) {
272
284
  const result: Date[] = [];
273
285
  if (Array.isArray(value) && value.length) {
@@ -196,6 +196,18 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
196
196
  * If the user passes an empty value, you need to set the range input focus to rangeStart, so that the user can continue to select from the beginning after clearing
197
197
  */
198
198
  initRangeInputFocus(result: Date[]): void;
199
+ /**
200
+ * value 可能是 UTC value 也可能是 zoned value
201
+ *
202
+ * UTC value -> 受控传入的 value
203
+ *
204
+ * zoned value -> statue.value,保存的是当前计算机时区下选择的日期
205
+ *
206
+ * 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
207
+ *
208
+ * 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
209
+ *
210
+ */
199
211
  parseWithTimezone(value: ValueType, timeZone: string | number, prevTimeZone: string | number): Date[];
200
212
  _isMultiple(): boolean;
201
213
  /**
@@ -150,6 +150,19 @@ class DatePickerFoundation extends _foundation.default {
150
150
  this._adapter.setRangeInputFocus('rangeStart');
151
151
  }
152
152
  }
153
+ /**
154
+ * value 可能是 UTC value 也可能是 zoned value
155
+ *
156
+ * UTC value -> 受控传入的 value
157
+ *
158
+ * zoned value -> statue.value,保存的是当前计算机时区下选择的日期
159
+ *
160
+ * 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
161
+ *
162
+ * 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
163
+ *
164
+ */
165
+
153
166
 
154
167
  parseWithTimezone(value, timeZone, prevTimeZone) {
155
168
  const result = [];
@@ -20,32 +20,33 @@ export declare const toIANA: (tz: string | number) => any;
20
20
  declare const parse: (date: string | number | Date, formatToken: string, options?: any) => Date;
21
21
  declare const format: (date: number | Date, formatToken: string, options?: any) => string;
22
22
  /**
23
- * Given a date and any time zone, returns a Date with the equivalent UTC time
23
+ * Returns a Date which will format as the local time of any time zone from a specific UTC time
24
24
  *
25
25
  * @example
26
26
  * ```javascript
27
- * import { zonedTimeToUtc } from 'date-fns-tz'
28
- * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone
29
- * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
30
- * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
27
+ * import { utcToZonedTime } from 'date-fns-tz'
28
+ * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
29
+ * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
30
+ * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
31
+ * renderTimeZoneSelect(timeZone) // America/New_York
31
32
  * ```
32
33
  *
33
- * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
34
+ * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
34
35
  */
35
36
  declare const utcToZonedTime: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
36
37
  /**
37
- * Get a date/time representing local time in a given time zone from the UTC date
38
+ * Given a date and any time zone, returns a Date with the equivalent UTC time
38
39
  *
39
40
  * @example
40
41
  * ```
41
- * import { utcToZonedTime } from 'date-fns-tz'
42
- * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
43
- * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
44
- * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
45
- * renderTimeZoneSelect(timeZone) // America/New_York
42
+ * import { zonedTimeToUtc } from 'date-fns-tz'
43
+ * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
44
+ * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
45
+ * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
46
+ * postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
46
47
  * ```
47
48
  *
48
- * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
49
+ * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
49
50
  */
50
51
  declare const zonedTimeToUtc: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
51
52
  /**
@@ -92,17 +92,18 @@ const format = (date, formatToken, options) => {
92
92
  return (0, _dateFnsTz.format)(date, formatToken, options);
93
93
  };
94
94
  /**
95
- * Given a date and any time zone, returns a Date with the equivalent UTC time
95
+ * Returns a Date which will format as the local time of any time zone from a specific UTC time
96
96
  *
97
97
  * @example
98
98
  * ```javascript
99
- * import { zonedTimeToUtc } from 'date-fns-tz'
100
- * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone
101
- * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
102
- * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
99
+ * import { utcToZonedTime } from 'date-fns-tz'
100
+ * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
101
+ * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
102
+ * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
103
+ * renderTimeZoneSelect(timeZone) // America/New_York
103
104
  * ```
104
105
  *
105
- * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
106
+ * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
106
107
  */
107
108
 
108
109
 
@@ -110,18 +111,18 @@ exports.format = format;
110
111
 
111
112
  const utcToZonedTime = (date, timeZone, options) => (0, _dateFnsTz.utcToZonedTime)(date, toIANA(timeZone), options);
112
113
  /**
113
- * Get a date/time representing local time in a given time zone from the UTC date
114
+ * Given a date and any time zone, returns a Date with the equivalent UTC time
114
115
  *
115
116
  * @example
116
117
  * ```
117
- * import { utcToZonedTime } from 'date-fns-tz'
118
- * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
119
- * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
120
- * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
121
- * renderTimeZoneSelect(timeZone) // America/New_York
118
+ * import { zonedTimeToUtc } from 'date-fns-tz'
119
+ * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
120
+ * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
121
+ * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
122
+ * postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
122
123
  * ```
123
124
  *
124
- * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
125
+ * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
125
126
  */
126
127
 
127
128
 
@@ -196,6 +196,18 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
196
196
  * If the user passes an empty value, you need to set the range input focus to rangeStart, so that the user can continue to select from the beginning after clearing
197
197
  */
198
198
  initRangeInputFocus(result: Date[]): void;
199
+ /**
200
+ * value 可能是 UTC value 也可能是 zoned value
201
+ *
202
+ * UTC value -> 受控传入的 value
203
+ *
204
+ * zoned value -> statue.value,保存的是当前计算机时区下选择的日期
205
+ *
206
+ * 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
207
+ *
208
+ * 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
209
+ *
210
+ */
199
211
  parseWithTimezone(value: ValueType, timeZone: string | number, prevTimeZone: string | number): Date[];
200
212
  _isMultiple(): boolean;
201
213
  /**
@@ -125,6 +125,19 @@ export default class DatePickerFoundation extends BaseFoundation {
125
125
  this._adapter.setRangeInputFocus('rangeStart');
126
126
  }
127
127
  }
128
+ /**
129
+ * value 可能是 UTC value 也可能是 zoned value
130
+ *
131
+ * UTC value -> 受控传入的 value
132
+ *
133
+ * zoned value -> statue.value,保存的是当前计算机时区下选择的日期
134
+ *
135
+ * 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
136
+ *
137
+ * 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
138
+ *
139
+ */
140
+
128
141
 
129
142
  parseWithTimezone(value, timeZone, prevTimeZone) {
130
143
  const result = [];
@@ -20,32 +20,33 @@ export declare const toIANA: (tz: string | number) => any;
20
20
  declare const parse: (date: string | number | Date, formatToken: string, options?: any) => Date;
21
21
  declare const format: (date: number | Date, formatToken: string, options?: any) => string;
22
22
  /**
23
- * Given a date and any time zone, returns a Date with the equivalent UTC time
23
+ * Returns a Date which will format as the local time of any time zone from a specific UTC time
24
24
  *
25
25
  * @example
26
26
  * ```javascript
27
- * import { zonedTimeToUtc } from 'date-fns-tz'
28
- * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone
29
- * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
30
- * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
27
+ * import { utcToZonedTime } from 'date-fns-tz'
28
+ * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
29
+ * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
30
+ * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
31
+ * renderTimeZoneSelect(timeZone) // America/New_York
31
32
  * ```
32
33
  *
33
- * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
34
+ * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
34
35
  */
35
36
  declare const utcToZonedTime: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
36
37
  /**
37
- * Get a date/time representing local time in a given time zone from the UTC date
38
+ * Given a date and any time zone, returns a Date with the equivalent UTC time
38
39
  *
39
40
  * @example
40
41
  * ```
41
- * import { utcToZonedTime } from 'date-fns-tz'
42
- * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
43
- * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
44
- * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
45
- * renderTimeZoneSelect(timeZone) // America/New_York
42
+ * import { zonedTimeToUtc } from 'date-fns-tz'
43
+ * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
44
+ * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
45
+ * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
46
+ * postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
46
47
  * ```
47
48
  *
48
- * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
49
+ * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
49
50
  */
50
51
  declare const zonedTimeToUtc: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
51
52
  /**
@@ -77,34 +77,35 @@ const format = (date, formatToken, options) => {
77
77
  return dateFnsFormat(date, formatToken, options);
78
78
  };
79
79
  /**
80
- * Given a date and any time zone, returns a Date with the equivalent UTC time
80
+ * Returns a Date which will format as the local time of any time zone from a specific UTC time
81
81
  *
82
82
  * @example
83
83
  * ```javascript
84
- * import { zonedTimeToUtc } from 'date-fns-tz'
85
- * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone
86
- * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
87
- * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
84
+ * import { utcToZonedTime } from 'date-fns-tz'
85
+ * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
86
+ * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
87
+ * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
88
+ * renderTimeZoneSelect(timeZone) // America/New_York
88
89
  * ```
89
90
  *
90
- * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
91
+ * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
91
92
  */
92
93
 
93
94
 
94
95
  const utcToZonedTime = (date, timeZone, options) => dateFnsUtcToZonedTime(date, toIANA(timeZone), options);
95
96
  /**
96
- * Get a date/time representing local time in a given time zone from the UTC date
97
+ * Given a date and any time zone, returns a Date with the equivalent UTC time
97
98
  *
98
99
  * @example
99
100
  * ```
100
- * import { utcToZonedTime } from 'date-fns-tz'
101
- * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
102
- * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
103
- * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
104
- * renderTimeZoneSelect(timeZone) // America/New_York
101
+ * import { zonedTimeToUtc } from 'date-fns-tz'
102
+ * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
103
+ * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
104
+ * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
105
+ * postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
105
106
  * ```
106
107
  *
107
- * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
108
+ * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
108
109
  */
109
110
 
110
111
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.31.3-alpha.1",
3
+ "version": "2.31.4",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "245df62669b489032329e4da301a5fdcabe11ecd",
26
+ "gitHead": "4db0a16b9639b0dc03799969f94d36d37d41c297",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -113,33 +113,34 @@ const format = (date: number | Date, formatToken: string, options?: any) => {
113
113
  };
114
114
 
115
115
  /**
116
- * Given a date and any time zone, returns a Date with the equivalent UTC time
116
+ * Returns a Date which will format as the local time of any time zone from a specific UTC time
117
117
  *
118
118
  * @example
119
119
  * ```javascript
120
- * import { zonedTimeToUtc } from 'date-fns-tz'
121
- * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone
122
- * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
123
- * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
120
+ * import { utcToZonedTime } from 'date-fns-tz'
121
+ * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
122
+ * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
123
+ * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
124
+ * renderTimeZoneSelect(timeZone) // America/New_York
124
125
  * ```
125
126
  *
126
- * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
127
+ * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
127
128
  */
128
129
  const utcToZonedTime = (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => dateFnsUtcToZonedTime(date, toIANA(timeZone), options);
129
130
 
130
131
  /**
131
- * Get a date/time representing local time in a given time zone from the UTC date
132
+ * Given a date and any time zone, returns a Date with the equivalent UTC time
132
133
  *
133
134
  * @example
134
135
  * ```
135
- * import { utcToZonedTime } from 'date-fns-tz'
136
- * const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
137
- * const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
138
- * renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
139
- * renderTimeZoneSelect(timeZone) // America/New_York
136
+ * import { zonedTimeToUtc } from 'date-fns-tz'
137
+ * const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
138
+ * const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
139
+ * const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
140
+ * postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
140
141
  * ```
141
142
  *
142
- * @see https://github.com/marnusw/date-fns-tz#utctozonedtime
143
+ * @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
143
144
  */
144
145
  const zonedTimeToUtc = (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => dateFnsZonedTimeToUtc(date, toIANA(timeZone), options);
145
146