Skip to content

Commit

Permalink
docs(your-first-app): switch to Date.now() (#2915)
Browse files Browse the repository at this point in the history
Co-authored-by: Maria Hutt <[email protected]>
  • Loading branch information
biskweet and thetaPC authored Jun 26, 2023
1 parent 9b65f4b commit 03022cb
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/angular/your-first-app/3-saving-photos.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docs/angular/your-first-app/5-adding-mobile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docs/react/your-first-app/2-taking-photos.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const [photos, setPhotos] = useState<UserPhoto[]>([]);
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,
Expand Down
2 changes: 1 addition & 1 deletion docs/react/your-first-app/3-saving-photos.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion docs/vue/your-first-app/2-taking-photos.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const photos = ref<UserPhoto[]>([]);
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,
Expand Down
2 changes: 1 addition & 1 deletion docs/vue/your-first-app/3-saving-photos.md
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const [photos, setPhotos] = useState<UserPhoto[]>([]);
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const photos = ref<UserPhoto[]>([]);
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

1 comment on commit 03022cb

@vercel
Copy link

@vercel vercel bot commented on 03022cb Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ionic-docs – ./

ionic-docs-git-main-ionic1.vercel.app
ionic-docs-gqykycf8t.vercel.app
ionic-docs-ionic1.vercel.app

Please sign in to comment.