Commit 69a844010eb46b6193145e10eb578848d3d9a652

Authored by 梁灏
1 parent de48db80

fix #4651

Showing 2 changed files with 7 additions and 4 deletions   Show diff stats
examples/routers/time.vue
... ... @@ -5,6 +5,8 @@
5 5 <Time :time="time2" />
6 6 <br>
7 7 <Time :time="time3" :interval="1" />
  8 + <br>
  9 + <Time :time="time4" />
8 10 </div>
9 11 </template>
10 12 <script>
... ... @@ -13,8 +15,9 @@
13 15 return {
14 16 time1: (new Date()).getTime() - 60 * 59 * 1000,
15 17 time2: (new Date()).getTime() - 86400 * 3 * 1000,
16   - time3: (new Date()).getTime() - 1 * 1000
17   - }
  18 + time3: (new Date()).getTime() - 1 * 1000,
  19 + time4: (new Date()).getTime() - 86400 * 60 * 1000,
  20 + };
18 21 }
19   - }
  22 + };
20 23 </script>
... ...
src/components/time/time.js
... ... @@ -30,7 +30,7 @@ const getHandledValue = num =&gt; {
30 30 * @param {Number} startType 要返回的时间字符串的格式类型,传入'year'则返回年开头的完整时间
31 31 */
32 32 const getDate = (timeStamp, startType) => {
33   - const d = new Date(timeStamp * 1000);
  33 + const d = new Date(timeStamp);
34 34 const year = d.getFullYear();
35 35 const month = getHandledValue(d.getMonth() + 1);
36 36 const date = getHandledValue(d.getDate());
... ...