Skip to content

Commit ccf1fce

Browse files
committed
add iframe component
add datetime convetion like unix, realtime update documentation
1 parent 62232da commit ccf1fce

File tree

5 files changed

+60
-7
lines changed

5 files changed

+60
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## JavaScript
66
- [JavaScript Form Validation](js/form-validation.js)
77
- [Select Single Checkbox](js/single-checkbox-selection.js)
8-
- [Date Time](js/datetime.js)
8+
- [Datetime (Unix , RealTime and Formatted Datetime)](js/datetime.js)
99
## React JS
1010
- [Exportable API Endpoint](react-js/api/ApiHelper.js)
1111
- [Example API Helper Routes ](react-js/api/ExampleApi.js)

js/single-checkbox-selection.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<!-- For Single Checkbox -->
1+
// <!-- For Single Checkbox -->
22
$('.product-list').on('change', function() {
33
$('.product-list').not(this).prop('checked', false);
44
});
55

6-
#Example
6+
// #Example
77
<label class="checkbox-inline">
88
<input type="checkbox" class="product-list">
99
</label>
1010

11-
Need jquery library
11+
{/* Need jquery library */}
1212
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

react-js/Iframe.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
3+
const Iframe = () => {
4+
5+
const style = { /* this is for full width iframe page load */
6+
iframe: {
7+
border: "none",
8+
top: 0, right: 0,
9+
bottom: 0, left: 0,
10+
width: "100%",
11+
height: "100vh"
12+
}
13+
14+
};
15+
16+
const src = "source route"
17+
return (
18+
<div>
19+
<iframe title="API Documentation" src="" style={style.iframe}/>
20+
</div>
21+
22+
);
23+
};
24+
25+
export default Iframe;

react-js/api/APIAsyncDataList.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ class TodoList extends Component {
1212
}
1313

1414
async componentDidMount() {
15-
await this.getTimesheetData()
15+
await this.getData()
1616
}
1717

1818
getData = async () => {
1919
const response = await api.endpoint("api route").getAll();
2020
this.setState({todos: response.data});
21-
setTimeout(this.getData, 1000); /*auto request to end point every second*/
21+
setTimeout(this.getData, 1000); /*auto request to endpoint every second to fetch data*/
2222
};
2323

2424

react-js/dateTime.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
export function _getDateTime(dateTime) {
1+
export {getDateTime, toRealDateTime, toUnixDateTimeNow}
2+
function getDateTime(dateTime) {
3+
/* description: this function is for formated datetime data,
4+
formatted like international datetime format: 12hr/AM/PM
5+
Additionally use timeZone:"Asia/Dhaka"
6+
params: datetime
7+
return: formatted date like 03:45PM 10/2/2019
8+
*/
29
if (dateTime) {
310
let date = new Date(dateTime);
411
let options = {
@@ -13,4 +20,25 @@ export function _getDateTime(dateTime) {
1320
//format like 10/10/2019 10:20AM
1421
}
1522
}
23+
function toRealDateTime(dateTime) {
24+
/*description: convert unix to real DataTime
25+
than again convert in to expected datetime
26+
formatted like 1/10/2019 10:01AM
27+
params: datetime
28+
return: formatted datetime again call to getDateTime function
29+
to display formatted datetime like 1/10/2019 10:01AM
30+
*/
31+
if (dateTime) {
32+
return getDateTime(Date(dateTime))
33+
}
34+
}
35+
36+
function toUnixDateTimeNow() {
37+
/*description: convert datetime to unix
38+
formatted like 1563044813038
39+
params: datetime
40+
return: formatted datetime like 1563044813038
41+
*/
42+
return new Date().getTime()
43+
}
1644

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy