diff --git a/package.json b/package.json index 8c28b74..861d9bf 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,6 @@ "axios": "^0.16.1", "dateformat": "^3.0.3", "element-ui": "^2.0.5", - "fecha": "^2.3.3", "fs-extra": "^4.0.2", "image-size": "^0.6.1", "keycode": "^2.1.9", diff --git a/src/main/utils/uploader.js b/src/main/utils/uploader.js index d7e6f27..789b3a1 100644 --- a/src/main/utils/uploader.js +++ b/src/main/utils/uploader.js @@ -5,7 +5,7 @@ import { ipcMain } from 'electron' import path from 'path' -import fecha from 'fecha' +import dayjs from 'dayjs' // eslint-disable-next-line const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require @@ -67,7 +67,7 @@ const uploader = (img, type, webContents) => { switch (type) { case 'imgFromClipboard': if (img !== null) { - const today = fecha.format(new Date(), 'YYYYMMDDHHmmss') + '.png' + const today = dayjs().format('YYYYMMDDHHmmss') + '.png' input = [ { base64Image: img.imgUrl.replace(/^data\S+,/, ''), @@ -88,11 +88,11 @@ const uploader = (img, type, webContents) => { handle: async ctx => { const rename = picgo.getConfig('settings.rename') const autoRename = picgo.getConfig('settings.autoRename') - await Promise.all(ctx.output.map(async item => { + await Promise.all(ctx.output.map(async (item, index) => { let name let fileName if (autoRename) { - fileName = fecha.format(new Date(), 'YYYYMMDDHHmmss') + item.extname + fileName = dayjs().add(index, 'second').format('YYYYMMDDHHmmss') + item.extname } else { fileName = item.fileName } diff --git a/yarn.lock b/yarn.lock index b92feab..86b4f15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3660,10 +3660,6 @@ fd-slicer@~1.0.1: dependencies: pend "~1.2.0" -fecha@^2.3.3: - version "2.3.3" - resolved "http://registry.npm.taobao.org/fecha/download/fecha-2.3.3.tgz#948e74157df1a32fd1b12c3a3c3cdcb6ec9d96cd" - figures@^1.4.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e"