Explorar o código

修复时间戳工具

zxlie %!s(int64=6) %!d(string=hai) anos
pai
achega
2dc6d80448
Modificáronse 2 ficheiros con 3 adicións e 3 borrados
  1. 1 1
      apps/manifest.json
  2. 2 2
      apps/timestamp/index.js

+ 1 - 1
apps/manifest.json

@@ -1,6 +1,6 @@
 {
   "name": "WEB前端助手(FeHelper)",
-  "version": "2019.03.1915",
+  "version": "2019.03.2016",
   "manifest_version": 2,
   "default_locale": "zh_CN",
   "description": "FE助手:包括JSON格式化、二维码生成与解码、信息编解码、代码压缩、美化、页面取色、Markdown与HTML互转、网页滚动截屏、正则表达式、时间转换工具、编码规范检测、页面性能检测、Ajax接口调试、密码生成器、JSON比对工具、网页编码设置、便签笔记",

+ 2 - 2
apps/timestamp/index.js

@@ -65,13 +65,13 @@ new Vue({
             let base = this.secFrom === 's' ? 1000 : 1;
             let format = 'yyyy-MM-dd HH:mm:ss' + (this.secFrom === 's' ? '' : ':SSS');
 
-            this.txtDesDate = (new Date(parseInt(this.txtSrcStamp, 10) * base)).format(format);
+            this.txtDesDate = (new Date(parseInt(this.txtSrcStamp, 10) * base + ( (new Date()).getTimezoneOffset() + this.curGMT * 60 ) * 60000)).format(format);
         },
         localeToStamp: function () {
             if (this.txtLocale && !/\s\d+:\d+:\d+/.test(this.txtLocale)) {
                 this.txtLocale += ' 00:00:00';
             }
-            let locale = Date.parse(this.txtLocale);
+            let locale = (new Date(Date.parse(this.txtLocale) - ( (new Date()).getTimezoneOffset() + this.curGMT * 60 ) * 60000)).getTime();
             if (isNaN(locale)) {
                 alert('请输入合法的时间格式,如:2014-04-01 10:01:01,或:2014-01-01');
             }