Skip to content

Commit e0bc683

Browse files
committed
Updating documentation to be more clear and correct
1 parent 83eeb81 commit e0bc683

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

DOCUMENTATION.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import DayJS from 'react-dayjs';
2626

2727
export default class MyComponent extends React.Component {
2828
render() {
29-
const date = "2000-01-31T12:59-0500";
29+
const date = "2000-01-31T11:59:00-05:00";
3030
return (
3131
<DayJS>{ date }</DayJS>
3232
);
@@ -50,7 +50,7 @@ _date = { string | number | Date | dayjs object }_
5050
The date to be displayed, if not given as children. The default is the current time.
5151

5252
```jsx
53-
<DayJS date={ "2000-01-31T12:59-0500" }>2000-01-31T12:59-0500</DayJS>
53+
<DayJS date={ "2000-01-31T11:59:00-05:00" }/>
5454
```
5555

5656
This will output:
@@ -68,7 +68,7 @@ The format the date should be displayed in. The default is `ISO 8601`, with no f
6868
The available formats can be found on the [dayjs][dayjs] README.
6969

7070
```jsx
71-
<DayJS format="MM-DD-YYYY">2000-01-31T12:59-0500</DayJS>
71+
<DayJS format="MM-DD-YYYY">2000-01-31T11:59:00-05:00</DayJS>
7272
```
7373

7474
This will output:
@@ -84,7 +84,7 @@ _element = { string | React.Component }_
8484
The element the component should be rendered as. The default is `time`.
8585

8686
```jsx
87-
<DayJS element="span">2000-01-31T12:59-0500</DayJS>
87+
<DayJS element="span">2000-01-31T11:59:00-05:00</DayJS>
8888
```
8989

9090
This will output:
@@ -99,7 +99,7 @@ _add = { object }_
9999
Adds a specific amount of time to the given date.
100100

101101
```jsx
102-
<DayJS add={ { hours: 1 } }>2000-01-31T12:59-0500</DayJS>
102+
<DayJS add={ { hours: 1 } }>2000-01-31T11:59:00-05:00</DayJS>
103103
```
104104

105105
This will output:
@@ -114,7 +114,7 @@ _subtract = { object }_
114114
Subtracts a specific amount of time to the given date.
115115

116116
```jsx
117-
<DayJS subtract={ { hours: 1 } }>2000-01-31T12:59-0500</DayJS>
117+
<DayJS subtract={ { hours: 1 } }>2000-01-31T11:59:00-05:00</DayJS>
118118
```
119119

120120
This will output:
@@ -129,7 +129,7 @@ _toJSON = { boolean }_
129129
Serializes a dayjs object to JSON, which returns an ISO8601 string.
130130

131131
```jsx
132-
<DayJS toJSON={ true }>2000-01-31T12:59-0500</DayJS>
132+
<DayJS toJSON={ true }>2000-01-31T11:59:00-05:00</DayJS>
133133
```
134134

135135
This will output:
@@ -144,7 +144,7 @@ _toISOString = { boolean }_
144144
Formats a date to an ISO8601 string.
145145

146146
```jsx
147-
<DayJS toISOString={ true }>2000-01-31T12:59-0500</DayJS>
147+
<DayJS toISOString={ true }>2000-01-31T11:59:00-05:00</DayJS>
148148
```
149149

150150
This will output:
@@ -159,7 +159,7 @@ _asString = { boolean }_
159159
Formats a date as a more readable string, using the `toString` dayjs function.
160160

161161
```jsx
162-
<DayJS asString={ true }>2000-01-31T12:59-0500</DayJS>
162+
<DayJS asString={ true }>2000-01-31T11:59:00-05:00</DayJS>
163163
```
164164

165165
This will output:
@@ -174,13 +174,13 @@ _unixSeconds = { boolean }_
174174
Displays the time as a unix timestamp (the number of seconds since Unix Epoch).
175175

176176
```jsx
177-
<DayJS unixSeconds={ true }>2000-01-31T12:59-0500</DayJS>
177+
<DayJS unixSeconds={ true }>2000-01-31T11:59:00-05:00</DayJS>
178178
```
179179

180180
This will output:
181181

182182
```html
183-
<time>949341540</time>
183+
<time>949337940</time>
184184
```
185185

186186
### unixMilliseconds
@@ -189,13 +189,13 @@ _unixMilliseconds = { boolean }_
189189
Displays the time as a unix timestamp in milliseconds (the number of milliseconds since Unix Epoch).
190190

191191
```jsx
192-
<DayJS unixMilliseconds={ true }>2000-01-31T12:59-0500</DayJS>
192+
<DayJS unixMilliseconds={ true }>2000-01-31T11:59:00-05:00</DayJS>
193193
```
194194

195195
This will output:
196196

197197
```html
198-
<time>949341540000</time>
198+
<time>949337940000</time>
199199
```
200200

201201
### daysInMonth
@@ -204,7 +204,7 @@ _daysInMonth = { boolean }_
204204
Displays the number of days in the month of the given time.
205205

206206
```jsx
207-
<DayJS daysInMonth={ true }>2000-01-31T12:59-0500</DayJS>
207+
<DayJS daysInMonth={ true }>2000-01-31T11:59:00-05:00</DayJS>
208208
```
209209

210210
This will output:
@@ -219,7 +219,7 @@ _displayIsValid = { boolean }_
219219
Displays if the given date is valid.
220220

221221
```jsx
222-
<DayJS displayIsValid={ true }>2000-01-31T12:59-0500</DayJS>
222+
<DayJS displayIsValid={ true }>2000-01-31T11:59:00-05:00</DayJS>
223223
```
224224

225225
This will output:

test/index.test.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import ReactDOM from "react-dom"
44
import TestUtils from "react-dom/test-utils"
55
import dayjs from "dayjs"
66

7-
const DATE_STRING = "2000-01-31T12:59-0500"
8-
const DATE_STRING_2 = "2100-01-31T12:59-0500"
7+
const DATE_STRING = "2000-01-31T11:59:00-05:00"
8+
const DATE_STRING_2 = "2100-01-31T11:59:00-05:00"
99

1010
describe("react-dayjs main", () => {
1111
it("default", () => {
@@ -29,7 +29,7 @@ describe("react-dayjs main", () => {
2929
})
3030

3131
it("should render date prop with date in milliseconds", () => {
32-
const date = TestUtils.renderIntoDocument(<DayJS date={ 949341540000 }/>)
32+
const date = TestUtils.renderIntoDocument(<DayJS date={ 949337940000 }/>)
3333
expect(ReactDOM.findDOMNode(date).innerHTML).toEqual(dayjs(DATE_STRING).format())
3434
})
3535

0 commit comments

Comments
 (0)