Skip to content

Commit

Permalink
chore!: Rename Datetime to DateTime in component names
Browse files Browse the repository at this point in the history
* `NcDatetime` is now called `NcDateTime`
* `NcDatetimePicker` is now called `NcDateTimePicker`

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Sep 23, 2023
1 parent ff69ac6 commit 28e56e7
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Without any optional parameters the timestamp is displayed as a relative datetim

```vue
<template>
<NcDatetime :timestamp="timestamp" />
<NcDateTime :timestamp="timestamp" />
</template>
<script>
export default {
Expand All @@ -52,7 +52,7 @@ If you do not want the seconds to be counted up until minutes are reached you ca

```vue
<template>
<NcDatetime :timestamp="timestamp" :ignore-seconds="true" />
<NcDateTime :timestamp="timestamp" :ignore-seconds="true" />
</template>
<script>
export default {
Expand All @@ -74,13 +74,13 @@ It is also possible to disable relative time by setting the `relativeTime` prope
<template>
<div>
<h4>Short relative time</h4>
<NcDatetime :timestamp="timestamp" relative-time="short" />
<NcDateTime :timestamp="timestamp" relative-time="short" />

<h4>Custom title format</h4>
<NcDatetime :timestamp="timestamp" :format="timeFormat" />
<NcDateTime :timestamp="timestamp" :format="timeFormat" />

<h4>Without relative time</h4>
<NcDatetime :timestamp="timestamp" :format="timeFormat" :relative-time="false" />
<NcDateTime :timestamp="timestamp" :format="timeFormat" :relative-time="false" />
</div>
</template>
<script>
Expand Down Expand Up @@ -123,7 +123,7 @@ const FEW_SECONDS_AGO = {
}
export default {
name: 'NcDatetime',
name: 'NcDateTime',
props: {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
*
*/

export { default } from './NcDatetime.vue'
export { default } from './NcDateTime.vue'
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
```vue
<template>
<span>
<NcDatetimePicker
<NcDateTimePicker
v-model="time"
type="datetime" />
{{ time }}
Expand All @@ -53,7 +53,7 @@ export default {
```vue
<template>
<span>
<NcDatetimePicker
<NcDateTimePicker
v-model="time"
type="datetime"
confirm />
Expand All @@ -75,7 +75,7 @@ export default {
```vue
<template>
<span>
<NcDatetimePicker
<NcDateTimePicker
v-model="time"
range
type="date" />
Expand All @@ -101,7 +101,7 @@ picked time zone, but you will have to convert it yourself when necessary.
```vue
<template>
<span>
<NcDatetimePicker
<NcDateTimePicker
v-model="time"
type="datetime"
:show-timezone-select="true"
Expand Down Expand Up @@ -200,7 +200,7 @@ const formatMap = {
}
export default {
name: 'NcDatetimePicker',
name: 'NcDateTimePicker',
components: {
CalendarBlank,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
*
*/
import './index.scss'
import NcDatetimePicker from './NcDatetimePicker.vue'
import NcDateTimePicker from './NcDateTimePicker.vue'
import ScopeComponent from '../../utils/ScopeComponent.js'

ScopeComponent(NcDatetimePicker)
ScopeComponent(NcDateTimePicker)

export default NcDatetimePicker
export default NcDateTimePicker
File renamed without changes.
4 changes: 2 additions & 2 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export { default as NcContent } from './NcContent/index.js'
export { default as NcCounterBubble } from './NcCounterBubble/index.js'
export { default as NcDashboardWidget } from './NcDashboardWidget/index.js'
export { default as NcDashboardWidgetItem } from './NcDashboardWidgetItem/index.js'
export { default as NcDatetime } from './NcDatetime/index.js'
export { default as NcDatetimePicker } from './NcDatetimePicker/index.js'
export { default as NcDateTime } from './NcDateTime/index.js'
export { default as NcDateTimePicker } from './NcDateTimePicker/index.js'
export { default as NcDateTimePickerNative } from './NcDateTimePickerNative/index.js'
// Not exported on purpose
// export { default as NcEllipsisedOption } from './NcEllipsisedOption/index.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
*/

import { mount } from '@vue/test-utils'
import NcDatetime from '../../../../src/components/NcDatetime/NcDatetime.vue'
import NcDateTime from '../../../../src/components/NcDateTime/NcDateTime.vue'

describe('NcDatetime.vue', () => {
describe('NcDateTime.vue', () => {
'use strict'

it('Sets the title property correctly', () => {
const time = Date.UTC(2023, 5, 23, 14, 30)
Date.now = jest.fn(() => new Date(time).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
Expand All @@ -42,7 +42,7 @@ describe('NcDatetime.vue', () => {
it('Can set format of the title property', () => {
const time = Date.UTC(2023, 5, 23, 14, 30)
Date.now = jest.fn(() => new Date(time).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
format: { dateStyle: 'long' },
Expand All @@ -56,7 +56,7 @@ describe('NcDatetime.vue', () => {
it('Can disable relative time', () => {
const time = Date.UTC(2023, 5, 23, 14, 30)
Date.now = jest.fn(() => new Date(time).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
relativeTime: false,
Expand All @@ -83,7 +83,7 @@ describe('NcDatetime.vue', () => {
it('', () => {
const time = Date.UTC(2023, 5, 23, 14, 30)
Date.now = jest.fn(() => new Date(time).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
Expand All @@ -98,7 +98,7 @@ describe('NcDatetime.vue', () => {
it('works with currentTime == timestamp', () => {
const time = Date.UTC(2023, 5, 23, 14, 30)
Date.now = jest.fn(() => new Date(time).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
Expand All @@ -112,7 +112,7 @@ describe('NcDatetime.vue', () => {
const time = Date.UTC(2023, 5, 23, 14, 30, 30)
let currentTime = Date.UTC(2023, 5, 23, 14, 30, 33)
Date.now = jest.fn(() => new Date(currentTime).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
Expand All @@ -130,7 +130,7 @@ describe('NcDatetime.vue', () => {
const time = Date.UTC(2023, 5, 23, 14, 30, 30)
const currentTime = Date.UTC(2023, 5, 23, 14, 30, 33)
Date.now = jest.fn(() => new Date(currentTime).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
relativeTime: 'short',
Expand All @@ -145,7 +145,7 @@ describe('NcDatetime.vue', () => {
const time = Date.UTC(2023, 5, 23, 14, 30, 30)
const currentTime = Date.UTC(2023, 5, 23, 14, 33, 30)
Date.now = jest.fn(() => new Date(currentTime).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
Expand All @@ -159,7 +159,7 @@ describe('NcDatetime.vue', () => {
const time = Date.UTC(2023, 5, 23, 14, 30, 30)
const currentTime = Date.UTC(2023, 5, 23, 17, 30, 30)
Date.now = jest.fn(() => new Date(currentTime).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
Expand All @@ -173,7 +173,7 @@ describe('NcDatetime.vue', () => {
const time = Date.UTC(2023, 5, 23, 14, 30, 30)
const currentTime = Date.UTC(2023, 6, 13, 14, 30, 30)
Date.now = jest.fn(() => new Date(currentTime).valueOf())
const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
Expand All @@ -189,12 +189,12 @@ describe('NcDatetime.vue', () => {
const currentTime = Date.UTC(2024, 6, 13, 14, 30, 30)
Date.now = jest.fn(() => new Date(currentTime).valueOf())

const wrapper = mount(NcDatetime, {
const wrapper = mount(NcDateTime, {
propsData: {
timestamp: time,
},
})
const wrapper2 = mount(NcDatetime, {
const wrapper2 = mount(NcDateTime, {
propsData: {
timestamp: time2,
},
Expand Down

0 comments on commit 28e56e7

Please sign in to comment.