adobe / htlengine

An HTL (Sightly) Interpreter/Compiler for Node.js
Apache License 2.0
47 stars 20 forks source link

format for dates does not follow htl-spec #146

Closed jantimon closed 4 years ago

jantimon commented 4 years ago

From the htl-spec for date formatting:

https://github.com/adobe/htl-spec/blob/master/SPECIFICATION.md#1222-dates

d - Day in month. Variants: dd
dd - Day in month with leading zero

However @adobe/htlengine is using momentjs for date parsing and momentjs is using a different syntax:

https://momentjs.com/docs/#/displaying/format/

d - Day of week
dd - `Su Mo ... Fr Sa`

A good solution might be to switch from momentjs to date-fns which is following a format similar to htl:

https://date-fns.org/v2.9.0/docs/format

Day of month 
| d | 1, 2, ..., 31 |  
| dd | 01, 02, ..., 31 |  
Day of year | D | 1, 2, ..., 365, 366 | 9
| Do | 1st, 2nd, ..., 365th, 366th | 7
| DD | 01, 02, ..., 365, 366 | 9
| DDD | 001, 002, ..., 365, 366 |  
| DDDD | ... | 3
adobe-bot commented 4 years ago

:tada: This issue has been resolved in version 4.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

jantimon commented 4 years ago

Cool nice 👍