diff --git a/docs/angular/your-first-app/3-saving-photos.md b/docs/angular/your-first-app/3-saving-photos.md index 27109d61432..c1e013a8bec 100644 --- a/docs/angular/your-first-app/3-saving-photos.md +++ b/docs/angular/your-first-app/3-saving-photos.md @@ -39,7 +39,7 @@ private async savePicture(photo: Photo) { const base64Data = await this.readAsBase64(photo); // Write the file to the data directory - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFile = await Filesystem.writeFile({ path: fileName, data: base64Data, diff --git a/docs/angular/your-first-app/5-adding-mobile.md b/docs/angular/your-first-app/5-adding-mobile.md index 3a3ebd92f23..ce7f60e75c5 100644 --- a/docs/angular/your-first-app/5-adding-mobile.md +++ b/docs/angular/your-first-app/5-adding-mobile.md @@ -62,7 +62,7 @@ private async savePicture(photo: Photo) { const base64Data = await this.readAsBase64(photo); // Write the file to the data directory - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFile = await Filesystem.writeFile({ path: fileName, data: base64Data, diff --git a/docs/react/your-first-app/2-taking-photos.md b/docs/react/your-first-app/2-taking-photos.md index 513d1a19d1f..9693e233c53 100644 --- a/docs/react/your-first-app/2-taking-photos.md +++ b/docs/react/your-first-app/2-taking-photos.md @@ -98,7 +98,7 @@ const [photos, setPhotos] = useState([]); 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: ```tsx -const fileName = new Date().getTime() + '.jpeg'; +const fileName = Date.now() + '.jpeg'; const newPhotos = [ { filepath: fileName, diff --git a/docs/react/your-first-app/3-saving-photos.md b/docs/react/your-first-app/3-saving-photos.md index cc6224d68a1..eae9a61df7b 100644 --- a/docs/react/your-first-app/3-saving-photos.md +++ b/docs/react/your-first-app/3-saving-photos.md @@ -71,7 +71,7 @@ const takePhoto = async () => { quality: 100, }); - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFileImage = await savePicture(photo, fileName); const newPhotos = [savedFileImage, ...photos]; setPhotos(newPhotos); diff --git a/docs/vue/your-first-app/2-taking-photos.md b/docs/vue/your-first-app/2-taking-photos.md index c95399f7024..9e50677a499 100644 --- a/docs/vue/your-first-app/2-taking-photos.md +++ b/docs/vue/your-first-app/2-taking-photos.md @@ -104,7 +104,7 @@ const photos = ref([]); 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: ```tsx -const fileName = new Date().getTime() + '.jpeg'; +const fileName = Date.now() + '.jpeg'; const savedFileImage = { filepath: fileName, webviewPath: photo.webPath, diff --git a/docs/vue/your-first-app/3-saving-photos.md b/docs/vue/your-first-app/3-saving-photos.md index 429ae929645..04f5085738f 100644 --- a/docs/vue/your-first-app/3-saving-photos.md +++ b/docs/vue/your-first-app/3-saving-photos.md @@ -60,7 +60,7 @@ const takePhoto = async () => { quality: 100, }); - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFileImage = await savePicture(photo, fileName); photos.value = [savedFileImage, ...photos.value]; diff --git a/versioned_docs/version-v6/angular/your-first-app/3-saving-photos.md b/versioned_docs/version-v6/angular/your-first-app/3-saving-photos.md index 27109d61432..c1e013a8bec 100644 --- a/versioned_docs/version-v6/angular/your-first-app/3-saving-photos.md +++ b/versioned_docs/version-v6/angular/your-first-app/3-saving-photos.md @@ -39,7 +39,7 @@ private async savePicture(photo: Photo) { const base64Data = await this.readAsBase64(photo); // Write the file to the data directory - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFile = await Filesystem.writeFile({ path: fileName, data: base64Data, diff --git a/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md b/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md index 3c6190e3799..28988755a4c 100644 --- a/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md +++ b/versioned_docs/version-v6/angular/your-first-app/5-adding-mobile.md @@ -62,7 +62,7 @@ private async savePicture(photo: Photo) { const base64Data = await this.readAsBase64(photo); // Write the file to the data directory - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFile = await Filesystem.writeFile({ path: fileName, data: base64Data, diff --git a/versioned_docs/version-v6/react/your-first-app/2-taking-photos.md b/versioned_docs/version-v6/react/your-first-app/2-taking-photos.md index 90c527521bd..1c460796688 100644 --- a/versioned_docs/version-v6/react/your-first-app/2-taking-photos.md +++ b/versioned_docs/version-v6/react/your-first-app/2-taking-photos.md @@ -98,7 +98,7 @@ const [photos, setPhotos] = useState([]); 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: ```tsx -const fileName = new Date().getTime() + '.jpeg'; +const fileName = Date.now() + '.jpeg'; const newPhotos = [ { filepath: fileName, diff --git a/versioned_docs/version-v6/react/your-first-app/3-saving-photos.md b/versioned_docs/version-v6/react/your-first-app/3-saving-photos.md index cc6224d68a1..eae9a61df7b 100644 --- a/versioned_docs/version-v6/react/your-first-app/3-saving-photos.md +++ b/versioned_docs/version-v6/react/your-first-app/3-saving-photos.md @@ -71,7 +71,7 @@ const takePhoto = async () => { quality: 100, }); - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFileImage = await savePicture(photo, fileName); const newPhotos = [savedFileImage, ...photos]; setPhotos(newPhotos); diff --git a/versioned_docs/version-v6/vue/your-first-app/2-taking-photos.md b/versioned_docs/version-v6/vue/your-first-app/2-taking-photos.md index 8fe97523339..74513752c2d 100644 --- a/versioned_docs/version-v6/vue/your-first-app/2-taking-photos.md +++ b/versioned_docs/version-v6/vue/your-first-app/2-taking-photos.md @@ -106,7 +106,7 @@ const photos = ref([]); 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: ```tsx -const fileName = new Date().getTime() + '.jpeg'; +const fileName = Date.now() + '.jpeg'; const savedFileImage = { filepath: fileName, webviewPath: photo.webPath, diff --git a/versioned_docs/version-v6/vue/your-first-app/3-saving-photos.md b/versioned_docs/version-v6/vue/your-first-app/3-saving-photos.md index 59b165ca9ab..8d06a3ea673 100644 --- a/versioned_docs/version-v6/vue/your-first-app/3-saving-photos.md +++ b/versioned_docs/version-v6/vue/your-first-app/3-saving-photos.md @@ -62,7 +62,7 @@ const takePhoto = async () => { quality: 100, }); - const fileName = new Date().getTime() + '.jpeg'; + const fileName = Date.now() + '.jpeg'; const savedFileImage = await savePicture(photo, fileName); photos.value = [savedFileImage, ...photos.value];