Skip to content

Commit 5443c7b

Browse files
authored
fix: pretty-date example in docs
This allows to copy&paste the example without running in errors, and without changing current semantics. I, however, believe the example is oudated because what the core `pretty-date` component actually does is: ```html <time @name="pretty-date" :datetime="toIso(date)"> { pretty(date) } <script> pretty(date) { return new(date).toLocaleDateString(this.locale, { year: 'numeric', month: 'long', day: 'numeric' }); } toIso(date) { return new Date(date).toISOString(); } </script> </time> ```
1 parent 783c717 commit 5443c7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/nuejs.org/docs/custom-components.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ Properties and methods are defined inside a `<script>` block that is a direct ch
271271
// Constructor method runs when the component is created
272272
constructor({ date, locale }) {
273273
if (locale) this.locale = locale;
274-
this.date = date;
274+
this.date = new Date(date);
275275
}
276276
277277
// Method to format the date into a readable string

0 commit comments

Comments
 (0)