File tree 5 files changed +60
-7
lines changed
5 files changed +60
-7
lines changed Original file line number Diff line number Diff line change 5
5
## JavaScript
6
6
- [ JavaScript Form Validation] ( js/form-validation.js )
7
7
- [ Select Single Checkbox] ( js/single-checkbox-selection.js )
8
- - [ Date Time ] ( js/datetime.js )
8
+ - [ Datetime (Unix , RealTime and Formatted Datetime) ] ( js/datetime.js )
9
9
## React JS
10
10
- [ Exportable API Endpoint] ( react-js/api/ApiHelper.js )
11
11
- [ Example API Helper Routes ] ( react-js/api/ExampleApi.js )
Original file line number Diff line number Diff line change 1
- <!-- For Single Checkbox -->
1
+ // <!-- For Single Checkbox -->
2
2
$ ( '.product-list' ) . on ( 'change' , function ( ) {
3
3
$ ( '.product-list' ) . not ( this ) . prop ( 'checked' , false ) ;
4
4
} ) ;
5
5
6
- #Example
6
+ // #Example
7
7
< label class = "checkbox-inline" >
8
8
< input type = "checkbox" class = "product-list" >
9
9
</ label >
10
10
11
- Need jquery library
11
+ { /* Need jquery library */ }
12
12
< script src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" > </ script >
Original file line number Diff line number Diff line change
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 ;
Original file line number Diff line number Diff line change @@ -12,13 +12,13 @@ class TodoList extends Component {
12
12
}
13
13
14
14
async componentDidMount ( ) {
15
- await this . getTimesheetData ( )
15
+ await this . getData ( )
16
16
}
17
17
18
18
getData = async ( ) => {
19
19
const response = await api . endpoint ( "api route" ) . getAll ( ) ;
20
20
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 */
22
22
} ;
23
23
24
24
Original file line number Diff line number Diff line change 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
+ */
2
9
if ( dateTime ) {
3
10
let date = new Date ( dateTime ) ;
4
11
let options = {
@@ -13,4 +20,25 @@ export function _getDateTime(dateTime) {
13
20
//format like 10/10/2019 10:20AM
14
21
}
15
22
}
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
+ }
16
44
You can’t perform that action at this time.
0 commit comments