Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 6410c0b

Browse files
feat: format date
1 parent 2b01177 commit 6410c0b

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

studio/src/app/modals/editor/app-publish/app-publish.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import {Component, Element, Listen, State} from '@stencil/core';
2-
import {User} from '../../../models/user';
2+
33
import {take} from 'rxjs/operators';
4+
5+
import DateTimeFormatOptions = Intl.DateTimeFormatOptions;
6+
7+
import {User} from '../../../models/user';
8+
49
import {AuthService} from '../../../services/auth/auth.service';
510

611
interface InputTargetEvent extends EventTarget {
@@ -26,10 +31,18 @@ export class AppPublish {
2631
@State()
2732
private user: User;
2833

34+
@State()
35+
private today: string;
36+
2937
constructor() {
3038
this.authService = AuthService.getInstance();
3139
}
3240

41+
async componentWillLoad() {
42+
const options: DateTimeFormatOptions = { year: 'numeric', month: 'short', day: 'numeric' };
43+
this.today = new Intl.DateTimeFormat('en-US', options).format(new Date());
44+
}
45+
3346
async componentDidLoad() {
3447
history.pushState({modal: true}, null);
3548

@@ -115,7 +128,7 @@ export class AppPublish {
115128
</p>
116129

117130
<p class="author" padding>
118-
<ion-label>{this.renderUser()} | Mars 9</ion-label>
131+
<ion-label>{this.renderUser()} | {this.today}</ion-label>
119132
</p>
120133
</div>
121134
<div class="preview">

0 commit comments

Comments
 (0)