# How do I use date formatting inside t-params.bind?

**URL:** <https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458>\
**Category:** Help Requests\
**Created:** [May 4, 2020, 11:39am UTC](https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458 "2020-05-04T11:39:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Weeaboo420](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@Weeaboo420](https://discourse.aurelia.io/u/Weeaboo420)\
**Post date:** [May 4, 2020, 11:39am UTC](https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458/1 "2020-05-04T11:39:14Z")

</div>

I am trying to format a date string inside a t-params.bind statement but every time I try to do so I just get errors saying that I am missing a comma which I don’t think I am. I’ve tried using a comma too and that gets rid of the error message but then I don’t get my formatted date like I want.

My html code looks almost like this (can’t share company code so it’s somewhat modified):

```
t-params.bind="{value: 'dateString | dateFormat: 'LLL'}"

```

I don’t know what to do, I can’t ask anyone for help at my company atm because they’re all in meetings.

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [May 4, 2020, 11:49am UTC](https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458/2 "2020-05-04T11:49:56Z")

</div>

It’s not missing a comma but a singlequote after dateString. Moreover I’m not sure whether you can use a valueconverter inside the params attribute. Is there a way that you format the dateString in your VM and assign that? E.g dateString might as well be a getter and inside you just perform the formatting plus computedFrom decorator so it doesn’t do unnecessary dirtyWatching

---

<div class="post-metadata">

**Author:** ![Weeaboo420](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@Weeaboo420](https://discourse.aurelia.io/u/Weeaboo420)\
**Post date:** [May 4, 2020, 11:55am UTC](https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458/3 "2020-05-04T11:55:11Z")

</div>

Hmm, well I tried adding in that missing singlequote but that didn’t help, unfortunately.  
I’m still pretty new to Aurelia and our workflow here, by “VM” do you mean virtual machine?

There may be a way for me to format the date in our typescript but I am not sure.

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [May 4, 2020, 12:26pm UTC](https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458/4 "2020-05-04T12:26:46Z")

</div>

Well then welcome to the board 😉

With VM I was referring to the ViewModel, so the code file that goes together with your View (your-component.ts/html).

In there you have somewhere your property `dateString` you’re binding to from the view. So instead try something like this perhaps

```auto
export class YourComponent {
  public get formattedDateString() {
    // return formatted string here
  }
}

```

---

<div class="post-metadata">

**Author:** ![Weeaboo420](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@Weeaboo420](https://discourse.aurelia.io/u/Weeaboo420)\
**Post date:** [May 4, 2020, 12:31pm UTC](https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458/5 "2020-05-04T12:31:34Z")

</div>

I finally got in touch with a co-worker and he was able to help me out. Turns out that we had to change some configuration settings in Aurelia and mess with the translations as well.

In our translation file we had a key-value pair that looked kinda like this:  
“exampleKey”: “Text: {{value}}”

and we only had to change it to:  
“exampleKey”: “Text: {{value, dateFormat:LLL}}”

and voilá, it works 🙂

---

<div class="post-metadata">

**Author:** ![zewa666](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/zewa666/32/19_2.png) [@zewa666](https://discourse.aurelia.io/u/zewa666)\
**Post date:** [May 4, 2020, 12:40pm UTC](https://discourse.aurelia.io/t/how-do-i-use-date-formatting-inside-t-params-bind/3458/6 "2020-05-04T12:40:07Z")

</div>

ahh ok, and that is where that ominous comma is missing 🙂 glad you got it figured.
