@94ai/nf-double-half-year 3.2.48 → 100.1.2

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.
@@ -78,7 +78,7 @@ import {
78
78
  getNextYear,
79
79
  getHalfYear,
80
80
  startOf
81
- } from './util'
81
+ } from '@94ai/common-utils'
82
82
  import { getHarfYearOptionMonths } from './config'
83
83
  import { HalfYearItem } from './types'
84
84
 
@@ -46,7 +46,7 @@ import {
46
46
  } from 'vue-demi'
47
47
  import { halfYearOptions } from './config'
48
48
  import { HalfYearItem } from './types'
49
- import { getHalfYear } from './util'
49
+ import { getHalfYear } from '@94ai/common-utils'
50
50
 
51
51
  const props = withDefaults(defineProps<{
52
52
  // 当前年
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-double-half-year",
3
- "version": "3.2.48",
3
+ "version": "100.1.2",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,7 +14,8 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-theme-chalk": "^3.2.48",
17
+ "@94ai/common-utils": "^100.1.2",
18
+ "@94ai/nf-theme-chalk": "^100.1.2",
18
19
  "vue-demi": "^0.14.5"
19
20
  },
20
21
  "peerDependenciesMeta": {
@@ -30,5 +31,5 @@
30
31
  "types": "lib/index.d.ts",
31
32
  "main": "lib/nf-double-half-year.cjs.js",
32
33
  "module": "lib/nf-double-half-year.esm-bundler.js",
33
- "gitHead": "91145bb7df8dad2c0cb3eefb101c6158ec854269"
34
+ "gitHead": "5b811c0e9d5ed95519222e3a9b744331734feeaf"
34
35
  }
package/lib/util.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export declare function getHalfYear(date?: Date): number;
2
- export declare function getNextYear(date?: Date): Date;
3
- export declare function endOf(now: Date | undefined, unit: any): Date;
4
- export declare function startOf(date: any, unit: any): Date;
5
- export declare function formatDate(date: any, format: any): any;
package/package/util.ts DELETED
@@ -1,58 +0,0 @@
1
- export function getHalfYear(date = new Date()) {
2
- const currMonth = date.getMonth() + 1
3
- return Math.floor((currMonth % 6 == 0 ? (currMonth / 6) : (currMonth / 6 + 1)))
4
- }
5
-
6
- export function getNextYear(date = new Date()) {
7
- return new Date(date.setFullYear(date.getFullYear() + 1))
8
- }
9
-
10
- export function endOf(now = new Date(), unit) {
11
- if (unit === 'year') {
12
- return new Date(now.getFullYear(), 11, 31, 23, 59, 59, 999);
13
- }
14
- if (unit === 'month') {
15
- return new Date(new Date(now.getFullYear(), now.getMonth() + 1, 1).getTime() - 1);
16
- }
17
- if (unit === 'week') {
18
- return new Date(now.getFullYear(), now.getMonth(), now.getDate() + (6 - now.getDay()), 23, 59, 59, 999);
19
- }
20
- return new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
21
- }
22
-
23
- export function startOf(date, unit) {
24
- const newDate = new Date(date)
25
- if (unit === 'year') {
26
- newDate.setMonth(0)
27
- newDate.setDate(1)
28
- newDate.setHours(0, 0, 0, 0)
29
- } else if (unit === 'month') {
30
- newDate.setDate(1)
31
- newDate.setHours(0, 0, 0, 0)
32
- } else if (unit === '') {
33
- newDate.setHours(0, 0, 0, 0)
34
- } else if (unit === 'hour') {
35
- newDate.setMinutes(0, 0, 0)
36
- } else if (unit === 'minute') {
37
- newDate.setSeconds(0, 0)
38
- } else if (unit === 'second') {
39
- newDate.setMilliseconds(0)
40
- }
41
- return newDate
42
- }
43
-
44
- export function formatDate(date, format) {
45
- const year = date.getFullYear()
46
- const month = date.getMonth() + 1
47
- const day = date.getDate()
48
- const hours = date.getHours()
49
- const minutes = date.getMinutes()
50
- const seconds = date.getSeconds()
51
- format = format.replace('YYYY', year)
52
- format = format.replace('MM', String(month).padStart(2, '0'))
53
- format = format.replace('DD', String(day).padStart(2, '0'))
54
- format = format.replace('HH', String(hours).padStart(2, '0'))
55
- format = format.replace('mm', String(minutes).padStart(2, '0'))
56
- format = format.replace('ss', String(seconds).padStart(2, '0'))
57
- return format
58
- }