Skip to content
This repository was archived by the owner on Jul 10, 2019. It is now read-only.

Commit f42a3ba

Browse files
committed
feat: add moment of npm module and add to use memont().utcOffset('+0900')
1 parent 9b369f1 commit f42a3ba

File tree

5 files changed

+66
-9
lines changed

5 files changed

+66
-9
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
"cross-env": "^5.2.0",
5959
"express": "^4.16.4",
6060
"js-cookie": "^2.2.0",
61+
"moment": "^2.24.0",
6162
"nuxt": "^2.6.2",
6263
"nuxt-client-init-module": "^0.1.4",
6364
"nuxt-env": "^0.1.0",
@@ -77,6 +78,7 @@
7778
"@types/express": "^4.16.1",
7879
"@types/jest": "^24.0.11",
7980
"@types/js-cookie": "^2.2.2",
81+
"@types/moment": "^2.13.0",
8082
"@types/prettier": "1.16.2",
8183
"@types/storybook__vue": "^5.0.1",
8284
"@typescript-eslint/eslint-plugin": "^1.6.0",

src/assets/styles/main.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@
3434
opacity: 0;
3535
transform: translate(-30px, 0);
3636
}
37+
38+
h1.title {
39+
font-size: 20px;
40+
margin-bottom: 10px;
41+
padding-left: 3px;
42+
border-left: 2px solid blueviolet;
43+
}

src/pages/example/index.vue

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template lang="pug">
22
section
3-
h1.red
3+
h1.title
44
| example index page
5-
| - nuxtServerInit has been called is {{ isServerInitCalled }}
6-
| - nuxtClientInit has been called is {{ isClientInitCalled }}
5+
p nuxtServerInit has been called is {{ isServerInitCalled }}
6+
p nuxtClientInit has been called is {{ isClientInitCalled }}
77
hr
88
p
99
nuxt-link(to='/example/auth/require-auth') require-auth
@@ -47,6 +47,8 @@ section
4747
nuxt-link(to='/example/i18n') i18n
4848
p
4949
nuxt-link(to='/example/animejs') animejs
50+
p
51+
nuxt-link(to='/example/now-utcoffset') now-utcoffset
5052
</template>
5153

5254
<script lang="ts">
@@ -65,12 +67,7 @@ export default class extends Vue {
6567
</script>
6668

6769
<style lang="scss" scoped>
68-
.red {
69-
margin: 5px;
70-
color: red;
71-
}
72-
7370
p {
74-
margin: 5px;
71+
margin-bottom: 5px;
7572
}
7673
</style>

src/pages/example/now-utcoffset.vue

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template lang="pug">
2+
section.container
3+
h1.title
4+
| now-utcoffset
5+
p now: {{ now }}
6+
p from-string: {{ fromString }}
7+
p now-date: {{ nowDate }}
8+
</template>
9+
10+
<script lang="ts">
11+
import { Component, Vue } from 'nuxt-property-decorator'
12+
import moment from 'moment'
13+
14+
@Component
15+
export default class extends Vue {
16+
public get now(): string {
17+
const dayWrapper = moment(new Date()).utcOffset('+0900')
18+
return dayWrapper.format()
19+
}
20+
21+
public get fromString(): string {
22+
const dayWrapper = moment('2013-03-07T07:00:00+09:00').utcOffset('+0900')
23+
return dayWrapper.format()
24+
}
25+
26+
public get nowDate(): string {
27+
const dayWrapper = moment(new Date()).utcOffset('+0900')
28+
return dayWrapper.format('YYYY-MM-DD')
29+
}
30+
31+
public head() {
32+
return {
33+
title: 'now-utcoffset'
34+
}
35+
}
36+
}
37+
</script>
38+
39+
<style lang="scss"></style>

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,6 +2246,13 @@
22462246
version "2.0.1"
22472247
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-2.0.1.tgz#dc488842312a7f075149312905b5e3c0b054c79d"
22482248

2249+
"@types/moment@^2.13.0":
2250+
version "2.13.0"
2251+
resolved "https://registry.yarnpkg.com/@types/moment/-/moment-2.13.0.tgz#604ebd189bc3bc34a1548689404e61a2a4aac896"
2252+
integrity sha1-YE69GJvDvDShVIaJQE5hoqSqyJY=
2253+
dependencies:
2254+
moment "*"
2255+
22492256
"@types/node@*":
22502257
version "11.9.5"
22512258
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.9.5.tgz#011eece9d3f839a806b63973e228f85967b79ed3"
@@ -8314,6 +8321,11 @@ [email protected], [email protected], "mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp
83148321
dependencies:
83158322
minimist "0.0.8"
83168323

8324+
moment@*, moment@^2.24.0:
8325+
version "2.24.0"
8326+
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
8327+
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
8328+
83178329
move-concurrently@^1.0.1:
83188330
version "1.0.1"
83198331
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"

0 commit comments

Comments
 (0)