formkit / tempo

📆 Parse, format, manipulate, and internationalize dates and times in JavaScript and TypeScript.
https://tempo.formkit.com
MIT License
2.34k stars 30 forks source link

Filtering out year still includes comma #48

Closed joelstein closed 5 months ago

joelstein commented 6 months ago

Interesting project you have here!

I tried to filter the year from the "long" date style and expected it to look like March 30 but it rendered March 30, (note the extra comma).

I wasn't sure if this was unavoidable, but I wanted to bring it to your attention.

format({
  date: someDate,
  format: {date: "long"},
  partFilter: (part) => part.partName !== "year",
})
justin-schroeder commented 5 months ago

Yeah, unfortunately it takes a bit more work to get clean dates using those more advanced features. The comma is actually another part (type: literal) which would itself need some filtering

joelstein commented 5 months ago

I'm just curious, but was this closed by accident? I downloaded the latest version this morning and ran the code above; the lingering comma is still there.