Skip to content

Commit 03022cb

Browse files
biskweetthetaPC
andauthored
docs(your-first-app): switch to Date.now() (#2915)
Co-authored-by: Maria Hutt <[email protected]>
1 parent 9b65f4b commit 03022cb

File tree

12 files changed

+12
-12
lines changed

12 files changed

+12
-12
lines changed

docs/angular/your-first-app/3-saving-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private async savePicture(photo: Photo) {
3939
const base64Data = await this.readAsBase64(photo);
4040

4141
// Write the file to the data directory
42-
const fileName = new Date().getTime() + '.jpeg';
42+
const fileName = Date.now() + '.jpeg';
4343
const savedFile = await Filesystem.writeFile({
4444
path: fileName,
4545
data: base64Data,

docs/angular/your-first-app/5-adding-mobile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private async savePicture(photo: Photo) {
6262
const base64Data = await this.readAsBase64(photo);
6363

6464
// Write the file to the data directory
65-
const fileName = new Date().getTime() + '.jpeg';
65+
const fileName = Date.now() + '.jpeg';
6666
const savedFile = await Filesystem.writeFile({
6767
path: fileName,
6868
data: base64Data,

docs/react/your-first-app/2-taking-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const [photos, setPhotos] = useState<UserPhoto[]>([]);
9898
When the camera is done taking a picture, the resulting Photo returned from Capacitor will be stored in the `photo` variable. We want to create a new photo object and add it to the photos state array. We make sure we don't accidently mutate the current photos array by making a new array, and then call `setPhotos` to store the array into state. Update the `takePhoto` method and add this code after the getPhoto call:
9999
100100
```tsx
101-
const fileName = new Date().getTime() + '.jpeg';
101+
const fileName = Date.now() + '.jpeg';
102102
const newPhotos = [
103103
{
104104
filepath: fileName,

docs/react/your-first-app/3-saving-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const takePhoto = async () => {
7171
quality: 100,
7272
});
7373

74-
const fileName = new Date().getTime() + '.jpeg';
74+
const fileName = Date.now() + '.jpeg';
7575
const savedFileImage = await savePicture(photo, fileName);
7676
const newPhotos = [savedFileImage, ...photos];
7777
setPhotos(newPhotos);

docs/vue/your-first-app/2-taking-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const photos = ref<UserPhoto[]>([]);
104104
When the camera is done taking a picture, the resulting `Photo` returned from Capacitor will be added to the `photos` array. Update the `takePhoto` function, adding this code after the `Camera.getPhoto` line:
105105

106106
```tsx
107-
const fileName = new Date().getTime() + '.jpeg';
107+
const fileName = Date.now() + '.jpeg';
108108
const savedFileImage = {
109109
filepath: fileName,
110110
webviewPath: photo.webPath,

docs/vue/your-first-app/3-saving-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const takePhoto = async () => {
6060
quality: 100,
6161
});
6262

63-
const fileName = new Date().getTime() + '.jpeg';
63+
const fileName = Date.now() + '.jpeg';
6464
const savedFileImage = await savePicture(photo, fileName);
6565

6666
photos.value = [savedFileImage, ...photos.value];

versioned_docs/version-v6/angular/your-first-app/3-saving-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private async savePicture(photo: Photo) {
3939
const base64Data = await this.readAsBase64(photo);
4040

4141
// Write the file to the data directory
42-
const fileName = new Date().getTime() + '.jpeg';
42+
const fileName = Date.now() + '.jpeg';
4343
const savedFile = await Filesystem.writeFile({
4444
path: fileName,
4545
data: base64Data,

versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private async savePicture(photo: Photo) {
6262
const base64Data = await this.readAsBase64(photo);
6363

6464
// Write the file to the data directory
65-
const fileName = new Date().getTime() + '.jpeg';
65+
const fileName = Date.now() + '.jpeg';
6666
const savedFile = await Filesystem.writeFile({
6767
path: fileName,
6868
data: base64Data,

versioned_docs/version-v6/react/your-first-app/2-taking-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const [photos, setPhotos] = useState<UserPhoto[]>([]);
9898
When the camera is done taking a picture, the resulting Photo returned from Capacitor will be stored in the `photo` variable. We want to create a new photo object and add it to the photos state array. We make sure we don't accidently mutate the current photos array by making a new array, and then call `setPhotos` to store the array into state. Update the `takePhoto` method and add this code after the getPhoto call:
9999
100100
```tsx
101-
const fileName = new Date().getTime() + '.jpeg';
101+
const fileName = Date.now() + '.jpeg';
102102
const newPhotos = [
103103
{
104104
filepath: fileName,

versioned_docs/version-v6/react/your-first-app/3-saving-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const takePhoto = async () => {
7171
quality: 100,
7272
});
7373

74-
const fileName = new Date().getTime() + '.jpeg';
74+
const fileName = Date.now() + '.jpeg';
7575
const savedFileImage = await savePicture(photo, fileName);
7676
const newPhotos = [savedFileImage, ...photos];
7777
setPhotos(newPhotos);

versioned_docs/version-v6/vue/your-first-app/2-taking-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const photos = ref<UserPhoto[]>([]);
106106
When the camera is done taking a picture, the resulting `Photo` returned from Capacitor will be added to the `photos` array. Update the `takePhoto` method, adding this code after the `Camera.getPhoto` line:
107107

108108
```tsx
109-
const fileName = new Date().getTime() + '.jpeg';
109+
const fileName = Date.now() + '.jpeg';
110110
const savedFileImage = {
111111
filepath: fileName,
112112
webviewPath: photo.webPath,

versioned_docs/version-v6/vue/your-first-app/3-saving-photos.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const takePhoto = async () => {
6262
quality: 100,
6363
});
6464

65-
const fileName = new Date().getTime() + '.jpeg';
65+
const fileName = Date.now() + '.jpeg';
6666
const savedFileImage = await savePicture(photo, fileName);
6767

6868
photos.value = [savedFileImage, ...photos.value];

0 commit comments

Comments
 (0)