优化组件/更新

This commit is contained in:
gyq
2025-12-03 10:13:55 +08:00
parent 92f9776a35
commit 09b6e36a52
261 changed files with 22080 additions and 7238 deletions

View File

@@ -1,13 +1,17 @@
# kux-dayjs
`KuxDayjs` 是一个极简的 `uts`API 设计完全参考 `dayjs` 的设计、所以上手该库基本零成本了,方便开发者们验证、操作和显示日期和时间。
## 开源地址:[https://gitcode.com/kviewui/kux-dayjs](https://gitcode.com/kviewui/kux-dayjs)
## 目录结构
<ol>
<div class="kux-ol" style="list-style-type: none;">
<ol style="list-style-type: none;">
<li><a href="#import">导入插件</a></li>
<li><a href="#parse">解析</a>
<ol>
<li><a href="#parse_shili">实例</a></li>
<li><a href="#parse_dangqianshijian">当前时间</a></li>
<li><a href="#parse_string">字符串</a></li>
<li><a href="#parse_clone">克隆复制</a></li>
</ol>
</li>
@@ -64,33 +68,88 @@
<li><a href="#display_isLeapYear">是否闰年</a></li>
</ol>
</li>
<li><a href="#customType">自定义类型</a>
<ol>
<li><a href="#customType_InfoType">InfoType</a></li>
<li><a href="#customType_LunarType">LunarType</a></li>
<li><a href="#customType_DatetimeUnit">DatetimeUnit</a></li>
<li><a href="#customType_DiffUnit">DiffUnit</a></li>
<li><a href="#customType_DateFormat">DateFormat</a></li>
<li><a href="#customType_RelativeTime">RelativeTime</a></li>
<li><a href="#customType_FromToOptions">FromToOptions</a></li>
<li><a href="#customType_DatetimeOptions">DatetimeOptions</a></li>
<li><a href="#customType_IsBetweenContains">IsBetweenContains</a></li>
</ol>
</li>
</ol>
</div>
### 导入插件
<a id="import"></a>
### 导入插件
```ts
import { dayjs } from '@/uni_modules/kux-dayjs';
```
### 解析
<a id="parse"></a>
### 解析
#### 实例
<a id="parse_shili"></a>
#### 实例
代替修改本地Date.prototype`KuxDayjs``Date` 对象进行了封装,只需要调用 `dayjs()` 即可
`KuxDayjs` 对象是不可变的,也就是说,以某种方式改变 `KuxDayjs` 对象的所有API操作都将返回它的一个新实例。
#### 当前时间
<a id="parse_dangqianshijian"></a>
#### 当前时间
直接调用 `dayjs()` 将返回一个包含当前日期和时间的 `KuxDayjs` 对象。
```ts
const now = dayjs();
```
>目前仅支持传入 `YYYY-MM-DD HH:mm:ss.S` 格式的日期时间字符串
>
> `1.0.2` 及以上版本支持字符串解析。请看 [字符串](#parse_string)
<a id="parse_string"></a>
#### 字符串
`1.0.2` 及以上版本开始支持字符串解析,支持各种主流字符串格式,具体如下:
+ YYYY-MM-DD
+ YYYY/MM/DD
+ YYYY-MM-DD HH
+ YYYY-MM-DD HH:MM
+ YYYY-MM-DD HH:MM:SS
+ YYYY-MM-DD HH:MM:SS.millis
+ YYYY/MM/DD HH
+ YYYY/MM/DD HH:MM
+ YYYY/MM/DD HH:MM:SS
+ YYYY/MM/DD HH:MM:SS.millis
+ ISO 8601 格式(包括 UTC 时间)
示例代码
```
console.log(dayjs('2023-12-13').format('YYYY-MM-DD'));
console.log(dayjs('2024/01/01').format('YYYY-MM-DD'));
console.log(dayjs('2023-12-13 12:23').format('YYYY-MM-DD HH:mm'));
console.log(dayjs('2023-12-13 12:23:45').format('YYYY-MM-DD HH:mm:ss'));
console.log(dayjs('2023-12-12 19:35:35.123').format('YYYY-MM-DD HH:mm:ss.SSS'));
console.log(dayjs('2023-12-13T10:16:18.000Z').format('YYYY-MM-DD HH:mm:ss'));
console.log(dayjs('2023-12-13T12:25:36.567+08:00').format('YYYY-MM-DD HH:mm:ss.SSS'));
console.log(dayjs(`${dayjs().valueOf()}`, true).format('YYYY-MM-DD HH:mm:ss'));
console.log(dayjs('1683234305000', true).format('YY-MM-DD HH:mm:ss'));
```
> **参数说明**
>
> 初始化参数目前为三个,见下面表格
>
> | 参数名 | 类型 | 必填 | 默认值 | 说明
> | --- | --- | --- | --- | ---
> | date | string | 否 | | 日期时间字符串,支持字符串格式的时间戳解析
> | isTimestamp | boolean | 否 | false | 是否为时间戳,是的话内部会自动转为整数作为时间戳解析
> | isCST | boolean | 否 | true | 是否是中国标准时间既UTC时间+8小时`isTimestamp` 为 `true` 时生效,默认为 `true`
#### 克隆复制
<a id="parse_clone"></a>
#### 克隆复制
所有的 `KuxDayjs` 对象都是不可变的。 但如果有必要,使用 `dayjs().clone()` 可以复制出一个当前对象。
```ts
const a = dayjs();
@@ -98,11 +157,11 @@ const b = a.clone();
// a 和 b 是两个独立的 KuxDayjs 对象
```
### 取值/赋值
<a id="getset"></a>
### 取值/赋值
#### 毫秒
<a id="getset_millisecond"></a>
#### 毫秒
获取或设置毫秒。<br/>
传入0到999的数字。 如果超出这个范围,它会进位到秒。
```ts
@@ -110,8 +169,8 @@ dayjs().millisecond()
dayjs().millisecond(1)
```
#### 秒
<a id="getset_second"></a>
#### 秒
获取或设置秒。<br/>
传入0到59的数字。 如果超出这个范围,它会进位到分钟。
```ts
@@ -119,8 +178,8 @@ dayjs().second()
dayjs().second(1)
```
#### 分钟
<a id="getset_minute"></a>
#### 分钟
获取或设置分钟。<br/>
传入0到59的数字。 如果超出这个范围,它会进位到小时。
```ts
@@ -128,8 +187,8 @@ dayjs().minute()
dayjs().minute(59)
```
#### 小时
<a id="getset_hour"></a>
#### 小时
获取或设置小时。<br/>
传入0到23的数字。 如果超出这个范围,它会进位到天数。
```ts
@@ -137,8 +196,8 @@ dayjs().hour()
dayjs().hour(12)
```
#### 日期
<a id="getset_date"></a>
#### 日期
获取或设置日期。<br/>
传入1到31的数字。 如果超出这个范围,它会进位到月份。
```ts
@@ -147,8 +206,8 @@ dayjs().date(1)
```
> ****注意****<br/>`dayjs().date()` 是该月的日期。`dayjs().day()` 是星期几。
#### 星期
<a id="getset_day"></a>
#### 星期
获取或设置星期几。<br/>
传入 number 从0(星期天)到6(星期六)。 如果超出这个范围,它会进位到其他周。
```ts
@@ -157,8 +216,8 @@ dayjs().day(0)
```
> ****注意****<br/>`dayjs().date()` 是该月的日期。`dayjs().day()` 是星期几。
#### 时间
<a id="getset_time"></a>
#### 时间
获取或设置时间。<br/>
传入一个整数,表示从 1970-1-1 00:00:00 UTC 开始计时的毫秒数。 传入参数就是设置操作,否则为获取操作。
```ts
@@ -166,8 +225,8 @@ dayjs().time()
dayjs().time(1)
```
#### 月
<a id="getset_month"></a>
#### 月
获取或设置月份。<br/>
传入0到11的 number。 如果超出这个范围,它会进位到年份。
```ts
@@ -176,24 +235,24 @@ dayjs().month(0)
```
> ****注意****<br/>月份是从 0 开始计算的,即 1 月是 0。
#### 年
<a id="getset_year"></a>
#### 年
获取或设置年份。<br/>
```ts
dayjs().year()
dayjs().year(2000)
```
### 操作
<a id="manipulate"></a>
### 操作
您可能需要一些方法来操作 `KuxDayjs` 对象。<br/>
`KuxDayjs` 支持像这样的链式调用。
```ts
dayjs('2019-01-25').add(1, 'day').subtract(1, 'year').year(2009);
```
#### 增加
<a id="manipulate_add"></a>
#### 增加
返回增加一定时间的复制的 `KuxDayjs` 对象。
```ts
dayjs().add(7, 'day')
@@ -208,8 +267,8 @@ dayjs().add(7, 'day')
+ second 秒,缩写 `s`
+ millisecond 毫秒,缩写 `ms`
#### 减去
<a id="manipulate_subtract"></a>
#### 减去
返回减去一定时间的复制的 `KuxDayjs` 对象。
```ts
dayjs().subtract(7, 'day')
@@ -224,15 +283,15 @@ dayjs().subtract(7, 'day')
+ second 秒,缩写 `s`
+ millisecond 毫秒,缩写 `ms`
#### 今天
<a id="manipulate_today"></a>
#### 今天
返回设置时间为今天的复制的 `KuxDayjs` 对象。
```ts
dayjs().today()
```
#### 时间的开始
<a id="manipulate_startOf"></a>
#### 时间的开始
返回复制的 `KuxDayjs` 对象,并设置到一个时间的开始。
```ts
dayjs().startOf('year')
@@ -249,8 +308,8 @@ dayjs().startOf('year')
>****注意****<br/>暂时不支持跨年操作。
#### 时间的结束
<a id="manipulate_endOf"></a>
#### 时间的结束
返回复制的 `KuxDayjs` 对象,并设置到一个时间的末尾。
```ts
dayjs().endOf('month')
@@ -267,12 +326,12 @@ dayjs().endOf('month')
>****注意****<br/>暂时不支持跨年操作。
### 显示
<a id="display"></a>
### 显示
当解析和操作完成后,您需要一些方式来展示 `KuxDayjs` 对象。
#### 格式化
<a id="display_format"></a>
#### 格式化
根据传入的占位符返回格式化后的日期。
```ts
dayjs().format('YYYY-MM-DD HH:mm:ss')
@@ -284,6 +343,7 @@ dayjs().format('YYYY-MM-DD HH:mm:ss A')
| 标识 | 示例 | 描述 |
| --- | --- | --- |
| YYYY | 2023 | 年份,四位数 |
| YY | 23 | 年份,两位数 |
| MM | 12 | 月份 |
| DD | 01 | 日,两位数 |
| HH | 22 | 小时,两位数 |
@@ -294,8 +354,8 @@ dayjs().format('YYYY-MM-DD HH:mm:ss A')
| a | am/pm | 上/下午,小写 |
| AA | 上/下午 | 上/下午 |
#### 相对当前时间(前)
<a id="display_fromNow"></a>
#### 相对当前时间(前)
返回现在到当前实例的相对时间。
```ts
dayjs('2021-12-12').fromNow(); // 1年前
@@ -308,22 +368,22 @@ dayjs('2021-12-12').fromNow(); // 1年前
| relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 |
#### RelativeTime 说明
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| 0 to 44seconds | s | %s | 几秒前 | %s seconds ago |
| 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago |
| 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago |
| 45 to 89 minutes | h | %h | 1小时前 | %h hour ago |
| 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago |
| 22 to 35 hours | d | d | %d | 1天前 | %d day ago |
| 22 to 35 hours | d | %d | 1天前 | %d day ago |
| 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago |
| 26 to 45 days | mon | %mon | 1个月前 | %mon month ago |
| 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago |
| 11 months to 17 months | y | %y | 1年前 | %y year ago |
| 18 months + | yy | %yy | 几年前 | %yy years ago |
#### 相对指定时间(前)
<a id="display_from"></a>
#### 相对指定时间(前)
返回 X 到当前实例的相对时间。
```ts
const datetime = dayjs('2021-12-12 15:43:58');
@@ -338,22 +398,22 @@ datetime.from(a); // 1年前
| relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 |
#### RelativeTime 说明
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| 0 to 44seconds | s | %s | 几秒前 | %s seconds ago |
| 45 to 89 seconds | m | %m | 1分钟前 | %m minute ago |
| 90 seconds to 44 minutes | mm | %mm | 几分钟前 | %mm minutes ago |
| 45 to 89 minutes | h | %h | 1小时前 | %h hour ago |
| 90 minutes to 21 hours | hh | %hh | 几小时前 | %hh hours ago |
| 22 to 35 hours | d | d | %d | 1天前 | %d day ago |
| 22 to 35 hours | d | %d | 1天前 | %d day ago |
| 36 hours to 25 days | dd | %dd | 几天前 | %dd days ago |
| 26 to 45 days | mon | %mon | 1个月前 | %mon month ago |
| 46 days to 10 months | mons | %mons | 几个月前 | %mons months ago |
| 11 months to 17 months | y | %y | 1年前 | %y year ago |
| 18 months + | yy | %yy | 几年前 | %yy years ago |
#### 相对当前时间(后)
<a id="display_toNow"></a>
#### 相对当前时间(后)
返回当前实例到现在的相对时间。
```ts
dayjs('2021-12-12').toNow(); // 1年后
@@ -366,22 +426,22 @@ dayjs('2021-12-12').toNow(); // 1年后
| relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 |
#### RelativeTime 说明
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| 0 to 44seconds | s | %s | 几秒后 | %s seconds after |
| 45 to 89 seconds | m | %m | 1分钟后 | %m minute after |
| 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after |
| 45 to 89 minutes | h | %h | 1小时后 | %h hour after |
| 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after |
| 22 to 35 hours | d | d | %d | 1天后 | %d day after |
| 22 to 35 hours | d | %d | 1天后 | %d day after |
| 36 hours to 25 days | dd | %dd | 几天后 | %dd days after |
| 26 to 45 days | mon | %mon | 1个月后 | %mon month after |
| 46 days to 10 months | mons | %mons | 几个月后 | %mons months after |
| 11 months to 17 months | y | %y | 1年后 | %y year after |
| 18 months + | yy | %yy | 几年后 | %yy years after |
#### 相对指定时间(后)
<a id="display_to"></a>
#### 相对指定时间(后)
返回当前实例到现在的相对时间。
```ts
const datetime = dayjs('2021-12-12 15:43:58');
@@ -396,22 +456,22 @@ console.log(datetime.to(a)); // 输出 1年后
| relativeTime | `{s: '', m: '', mm: '', h: '', hh: '', d: '', dd: '', mon: '', mons: '', y: '', yy: ''}` | 自定义格式,变量说明见下方说明 |
#### RelativeTime 说明
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| 范围 | 键 | 使用变量 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| 0 to 44seconds | s | %s | 几秒后 | %s seconds after |
| 45 to 89 seconds | m | %m | 1分钟后 | %m minute after |
| 90 seconds to 44 minutes | mm | %mm | 几分钟后 | %mm minutes after |
| 45 to 89 minutes | h | %h | 1小时后 | %h hour after |
| 90 minutes to 21 hours | hh | %hh | 几小时后 | %hh hours after |
| 22 to 35 hours | d | d | %d | 1天后 | %d day after |
| 22 to 35 hours | d | %d | 1天后 | %d day after |
| 36 hours to 25 days | dd | %dd | 几天后 | %dd days after |
| 26 to 45 days | mon | %mon | 1个月后 | %mon month after |
| 46 days to 10 months | mons | %mons | 几个月后 | %mons months after |
| 11 months to 17 months | y | %y | 1年后 | %y year after |
| 18 months + | yy | %yy | 几年后 | %yy years after |
#### 日历时间
<a id="display_calendar"></a>
#### 日历时间
传入指定年月获取指定年月的日历面板数据,指定年月省略时默认获取当年年月的数据。返回 `DateFormat[]``DateFormat` 见下方说明。
```ts
dayjs().calendar();
@@ -458,8 +518,8 @@ dayjs().calendar();
| lunarD | `number` | 农历日期数字
| isLeap | `boolean` | 是否闰月
#### 差异Diff
<a id="display_diff"></a>
#### 差异Diff
返回指定单位下两个日期时间之间的差异。
```ts
const date1 = dayjs('2019-01-25');
@@ -486,70 +546,69 @@ date1.diff('2018-06-05', 'month', true) // 7.645161290322581;
+ second 秒,缩写 `s`
+ millisecond 毫秒,缩写 `ms`
#### Unix时间戳毫秒
<a id="display_valueOf"></a>
#### Unix时间戳毫秒
返回当前实例的 UNIX 时间戳13位数字毫秒
```ts
dayjs('2019-01-25').valueOf() // 1548381600000
```
#### Unix时间戳
<a id="display_unix"></a>
#### Unix时间戳
返回当前实例的 UNIX 时间戳10位数字
```ts
dayjs('2019-01-25').valueOf() // 1548381600
```
此值不包含毫秒信息,会进位到秒。
#### 获取月天数
<a id="display_daysInMonth"></a>
#### 获取月天数
获取当前月份包含的天数。
```ts
const date = dayjs('2023-12-12'); // 31
```
#### 转Date
<a id="display_toDate"></a>
#### 转Date
`KuxDayjs` 中获取原生的Date对象。
```ts
dayjs('2023-12-12').toDate();
```
#### 转数组
<a id="display_toArray"></a>
#### 转数组
返回一个包含各个时间信息的 Array。
```ts
const datetime = dayjs('2023-12-13 10:16:18');// [2023,12,13,10,16,18,0]
```
#### 转JSON
<a id="display_toJSON"></a>
#### 转JSON
序列化为 `ISO 8601` 格式的字符串。
```ts
dayjs('2023-12-13 10:16:18').toJSON(); // 2023-12-13T10:16:18.000Z
```
#### 转对象
<a id="display_toObject"></a>
#### 转对象
返回包含时间信息的 Object。
```ts
dayjs('2023-12-13 10:16:18').toObject(); // {"date":13,"hours":10,"milliseconds":0,"minutes":16,"months":12,"seconds":18,"years":2023}
```
#### 转字符串
<a id="display_toRFCString"></a>
#### 转字符串
返回包含时间信息的 `RFC 822``RFC 5322` 格式字符串。
```ts
dayjs('2023-12-13 10:16:18').toRFCString(); // Wed, 13 Dec 2023 10:16:18 GMT
```
### 查询
<a id="query"></a>
### 查询
`KuxDayjs` 对象还有很多查询的方法。
#### 是否之前
<a id="query_isBefore"></a>
#### 是否之前
表示 `KuxDayjs` 对象是否在另一个提供的日期时间之前。
```ts
dayjs('2023-12-13 10:16:18').isBefore('2024-12-12'); // true
@@ -567,8 +626,8 @@ dayjs('2023-12-13 10:16:18').isBefore('2024-12-12', 'year'); // true
+ second - 秒,缩写为 `s`
+ millisecond - 毫秒,缩写为 `ms`
#### 是否相同
<a id="query_isSame"></a>
#### 是否相同
表示 `KuxDayjs` 对象是否和另一个提供的日期时间相同。
```ts
dayjs('2023-12-13 10:16:18').isBefore('2023-12-12'); // false
@@ -586,8 +645,8 @@ dayjs('2023-12-13 10:16:18').isBefore('2023-12-12', 'year'); // true
+ second - 秒,缩写为 `s`
+ millisecond - 毫秒,缩写为 `ms`
#### 是否之后
<a id="query_isAfter"></a>
#### 是否之后
表示 `KuxDayjs` 对象是否在另一个提供的日期时间之后。
```ts
dayjs('2023-12-13 10:16:18').isAfter('2023-12-12'); // true
@@ -605,8 +664,8 @@ dayjs('2023-12-13 10:16:18').isAfter('2023-12-12', 'year'); // true
+ second - 秒,缩写为 `s`
+ millisecond - 毫秒,缩写为 `ms`
#### 是否相同或之前
<a id="query_isSameOrBefore"></a>
#### 是否相同或之前
表示 `KuxDayjs` 对象是和另一个提供的日期时间相同或在其之前。
```ts
dayjs('2023-12-13 10:16:18').isSameOrBefore('2023-12-12'); // false
@@ -624,8 +683,8 @@ dayjs('2023-12-13 10:16:18').isSameOrBefore('2023-12-12', 'year'); // true
+ second - 秒,缩写为 `s`
+ millisecond - 毫秒,缩写为 `ms`
#### 是否相同或之后
<a id="query_isSameOrAfter"></a>
#### 是否相同或之后
表示 `KuxDayjs` 对象是和另一个提供的日期时间相同或在其之前。
```ts
dayjs('2023-12-13 10:16:18').isSameOrAfter('2023-12-12'); // true
@@ -643,8 +702,8 @@ dayjs('2023-12-13 10:16:18').isSameOrAfter('2023-12-12', 'year'); // true
+ second - 秒,缩写为 `s`
+ millisecond - 毫秒,缩写为 `ms`
#### 是否两者之间
<a id="query_isBetween"></a>
#### 是否两者之间
表示 `KuxDayjs` 对象是否在其他两个的日期时间之间。
```ts
dayjs('2023-12-13').isBetween('2023-12-13', '2023-12-14'); // 默认毫秒
@@ -671,6 +730,7 @@ dayjs('2023-12-13').isBetween('2023-12-13', '2023-12-14', 'day', '[');
+ `]` - 向后包含,等同于 `>=`
+ `[]` - 前后都包含
<a id="display_isDayjs"></a>
#### 是否是KuxDayjs
这表示一个变量是否为 `KuxDayjs` 对象。
```ts
@@ -678,8 +738,155 @@ dayjs().isDayjs(dayjs()); // true
dayjs().isDayjs(new Date()); // false
```
<a id="display_isLeapYear"></a>
#### 是否闰年
查询 `KuxDayjs` 对象的年份是否是闰年。
```ts
dayjs('2000-01-01').isLeapYear(); // true
```
```
<a id="customType"></a>
### 自定义类型
因为 `uts` 强类型,所以有些 API 参数需要指定参数类型,以上所有 API 涉及的自定义类型都在下面列出,如果有需要可以自己手动导入类型使用。
<a id="customType_InfoType"></a>
#### InfoType
```ts
export type InfoType = {
lunarY : number;
lunarM : number;
lunarD : number;
isLeap : boolean;
}
```
<a id="customType_LunarType"></a>
#### LunarType
```ts
export type LunarType = {
month: string;
date: string;
};
```
<a id="customType_DatetimeUnit"></a>
#### DatetimeUnit
```ts
export type DatetimeUnit =
| 'day'
| 'd'
| 'month'
| 'M'
| 'year'
| 'y'
| 'hour'
| 'h'
| 'minute'
| 'm'
| 'second'
| 's'
| 'millisecond'
| 'ms'
```
<a id="customType_DiffUnit"></a>
#### DiffUnit
```ts
export type DiffUnit =
| 'week'
| 'w'
| 'day'
| 'd'
| 'month'
| 'M'
| 'year'
| 'y'
| 'hour'
| 'h'
| 'minute'
| 'm'
| 'second'
| 's'
| 'millisecond'
| 'ms'
```
<a id="customType_DateFormat"></a>
#### DateFormat
```ts
export type DateFormat = {
year: number;
month: number;
date: number;
render: any;
lunar: LunarType;
fullLunar: InfoType;
diffDays: number;
isToday: boolean;
fullDate: string;
};
```
<a id="customType_RelativeTime"></a>
#### RelativeTime
```ts
export type RelativeTime = {
s?: string;
m?: string;
mm?: string;
h?: string;
hh?: string;
d?: string;
dd?: string;
mon?: string;
mons?: string;
y?: string;
yy?: string;
};
```
<a id="customType_FromToOptions"></a>
#### FromToOptions
```ts
export type FromToOptions = {
isSuffix?: boolean;
relativeTime?: RelativeTime;
};
```
<a id="customType_DatetimeOptions"></a>
#### DatetimeOptions
```ts
export type DatetimeOptions = {
years: number;
months: number;
date: number;
hours: number;
minutes: number;
seconds: number;
milliseconds: number;
};
```
<a id="customType_IsBetweenContains"></a>
#### IsBetweenContains
```ts
export type IsBetweenContains =
| '['
| ']'
| '[]'
| ''
```
---
### 结语
#### kux 不生产代码只做代码的搬运工致力于提供uts 的 js 生态轮子实现,欢迎各位大佬在插件市场搜索使用 kux 生态插件:[https://ext.dcloud.net.cn/search?q=kux](https://ext.dcloud.net.cn/search?q=kux)
___
### 友情推荐
+ [GVIM即时通讯模版](https://ext.dcloud.net.cn/plugin?id=16419)GVIM即时通讯模版基于uni-app x开发的一款即时通讯模版
+ [t-uvue-ui](https://ext.dcloud.net.cn/plugin?id=15571)T-UVUE-UI是基于UNI-APP X开发的前端UI框架
+ [UxFrame 低代码高性能UI框架](https://ext.dcloud.net.cn/plugin?id=16148)【F2图表、双滑块slider、炫酷效果tabbar、拖拽排序、日历拖拽选择、签名...】UniAppX 高质量UI库
+ [wx-ui 基于uni-app x开发的高性能混合UI库](https://ext.dcloud.net.cn/plugin?id=15579)基于uni-app x开发的高性能混合UI库集成 uts api 和 uts component提供了一套完整、高效且易于使用的UI组件和API让您以更少的时间成本轻松完成高性能应用开发。
+ [firstui-uvue](https://ext.dcloud.net.cn/plugin?id=16294)FirstUIunix组件库一款适配 uni-app x 的轻量、简洁、高效、全面的移动端组件库。
+ [easyXUI 不仅仅是UI 更是为UniApp X设计的电商模板库](https://ext.dcloud.net.cn/plugin?id=15602)easyX 不仅仅是UI库更是一个轻量、可定制的UniAPP X电商业务模板库可作为官方组件库的补充,始终坚持简单好用、易上手