Skip to content

Commit

Permalink
feat: add time zone support
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Mar 25, 2024
1 parent f99607b commit ec231f2
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 12 deletions.
7 changes: 7 additions & 0 deletions apps/zhi-infra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-infra

## 0.21.6

### Patch Changes

- Updated dependencies
- zhi-common@1.33.0

## 0.21.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/zhi-infra/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-infra",
"version": "0.21.5",
"version": "0.21.6",
"type": "module",
"description": "basic issues for zhi",
"main": "./dist/index.cjs",
Expand Down
7 changes: 7 additions & 0 deletions libs/zhi-blog-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-blog-api

## 1.56.4

### Patch Changes

- Updated dependencies
- zhi-common@1.33.0

## 1.56.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-blog-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-blog-api",
"version": "1.56.3",
"version": "1.56.4",
"type": "module",
"description": "a common blog interface",
"main": "./dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions libs/zhi-common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# zhi-common

## 1.33.0

### Minor Changes

- feat: add time zone support

## 1.32.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-common",
"version": "1.32.0",
"version": "1.33.0",
"type": "module",
"description": "a collection of util tools",
"main": "./dist/index.js",
Expand Down
10 changes: 6 additions & 4 deletions libs/zhi-common/src/lib/dateUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,26 @@ class DateUtil {
* 时间戳转时间
*
* @param timestamp - 时间戳
* @param isAddTimeZone
*/
public static formatTimestampToZhDate(timestamp: any) {
public static formatTimestampToZhDate(timestamp: any, isAddTimeZone?: boolean) {
if (typeof timestamp == "string") {
timestamp = parseInt(timestamp)
}
return this.formatIsoToZhDate(new Date(timestamp).toISOString())
return this.formatIsoToZhDate(new Date(timestamp).toISOString(), isAddTimeZone)
}

/**
* 时间戳转完整时间
*
* @param timestamp - 时间戳
* @param isAddTimeZone
*/
public static formatTimestampToZh(timestamp: any) {
public static formatTimestampToZh(timestamp: any, isAddTimeZone?: boolean) {
if (typeof timestamp == "string") {
timestamp = parseInt(timestamp)
}
return this.formatIsoToZh(new Date(timestamp).toISOString())
return this.formatIsoToZh(new Date(timestamp).toISOString(), isAddTimeZone)
}

/**
Expand Down
7 changes: 7 additions & 0 deletions libs/zhi-fetch-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-fetch-middleware

## 0.9.1

### Patch Changes

- Updated dependencies
- zhi-common@1.33.0

## 0.9.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-fetch-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-fetch-middleware",
"version": "0.9.0",
"version": "0.9.1",
"type": "module",
"description": "an intermediate tier prepared for fetch requests",
"main": "./dist/index.js",
Expand Down
7 changes: 7 additions & 0 deletions libs/zhi-github-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-github-middleware

## 0.4.17

### Patch Changes

- Updated dependencies
- zhi-common@1.33.0

## 0.4.16

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-github-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-github-middleware",
"version": "0.4.16",
"version": "0.4.17",
"type": "module",
"description": "a middleware for github api",
"main": "./dist/index.js",
Expand Down
6 changes: 6 additions & 0 deletions libs/zhi-gitlab-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# zhi-gitlab-middleware

## 0.7.1

### Patch Changes

- zhi-fetch-middleware@0.9.1

## 0.7.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-gitlab-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-gitlab-middleware",
"version": "0.7.0",
"version": "0.7.1",
"type": "module",
"description": "a middleware for gitlab api ",
"main": "./dist/index.js",
Expand Down
8 changes: 8 additions & 0 deletions libs/zhi-siyuan-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# zhi-siyuan-api

## 2.19.1

### Patch Changes

- Updated dependencies
- zhi-common@1.33.0
- zhi-blog-api@1.56.4

## 2.19.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-siyuan-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-siyuan-api",
"version": "2.19.0",
"version": "2.19.1",
"type": "module",
"description": "a siyuan-note api including both kernel and client",
"main": "./dist/index.js",
Expand Down
7 changes: 7 additions & 0 deletions libs/zhi-xmlrpc-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-xmlrpc-middleware

## 0.6.21

### Patch Changes

- Updated dependencies
- zhi-common@1.33.0

## 0.6.20

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-xmlrpc-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-xmlrpc-middleware",
"version": "0.6.20",
"version": "0.6.21",
"type": "module",
"description": "abstract xmlrpc middle layer",
"main": "./dist/index.js",
Expand Down

0 comments on commit ec231f2

Please sign in to comment.