Skip to content

Commit f0d0285

Browse files
committed
Change use of arrow functions to regular functions
1 parent 033d38a commit f0d0285

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/utilities/time_date.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import p5 from '../core/main';
2525
* Current day is displayed
2626
*
2727
*/
28-
p5.prototype.day = () => new Date().getDate();
28+
p5.prototype.day = function() {
29+
return new Date().getDate();
30+
};
2931

3032
/**
3133
* p5.js communicates with the clock on your computer. The <a href="#/p5/hour">hour()</a> function
@@ -45,7 +47,9 @@ p5.prototype.day = () => new Date().getDate();
4547
* Current hour is displayed
4648
*
4749
*/
48-
p5.prototype.hour = () => new Date().getHours();
50+
p5.prototype.hour = function() {
51+
return new Date().getHours();
52+
};
4953

5054
/**
5155
* p5.js communicates with the clock on your computer. The <a href="#/p5/minute">minute()</a> function
@@ -65,7 +69,9 @@ p5.prototype.hour = () => new Date().getHours();
6569
* Current minute is displayed
6670
*
6771
*/
68-
p5.prototype.minute = () => new Date().getMinutes();
72+
p5.prototype.minute = function() {
73+
return new Date().getMinutes();
74+
};
6975

7076
/**
7177
* Returns the number of milliseconds (thousandths of a second) since
@@ -108,9 +114,10 @@ p5.prototype.millis = function() {
108114
* Current month is displayed
109115
*
110116
*/
111-
p5.prototype.month = () =>
117+
p5.prototype.month = function() {
112118
//January is 0!
113-
new Date().getMonth() + 1;
119+
return new Date().getMonth() + 1;
120+
};
114121

115122
/**
116123
* p5.js communicates with the clock on your computer. The <a href="#/p5/second">second()</a> function
@@ -130,7 +137,9 @@ p5.prototype.month = () =>
130137
* Current second is displayed
131138
*
132139
*/
133-
p5.prototype.second = () => new Date().getSeconds();
140+
p5.prototype.second = function() {
141+
return new Date().getSeconds();
142+
};
134143

135144
/**
136145
* p5.js communicates with the clock on your computer. The <a href="#/p5/year">year()</a> function
@@ -150,6 +159,8 @@ p5.prototype.second = () => new Date().getSeconds();
150159
* Current year is displayed
151160
*
152161
*/
153-
p5.prototype.year = () => new Date().getFullYear();
162+
p5.prototype.year = function() {
163+
return new Date().getFullYear();
164+
};
154165

155166
export default p5;

0 commit comments

Comments
 (0)