Closed morgenstern closed 5 years ago
I want to use correct German grammar for time ago which needs the :ago word be placed before the number of days/hours etc.
Example: English: 17 days ago German: vor 17 Tagen
This could be changed through diffForHumans settings as follows:
diffForHumans: { past: ":ago :a :w", },
BUT unfortunately the parser replaces :a before replacing :ago which leads to broken results: 17go 17 Tagen [:a]go [:a] [:w]
:a
:ago
Possible solution: Change the order in which the parser replaces :a an :ago as follows
FROM:
return parser .replace(/\:a/, amount) .replace(/\:ago/, options.i18n.ago) .replace(/\:in/, options.i18n.in) .replace(/\:w/, str); };
TO:
return parser .replace(/\:ago/, options.i18n.ago) .replace(/\:in/, options.i18n.in) .replace(/\:a/, amount) .replace(/\:w/, str); };
I'll change it in the next version. Thanks!
I want to use correct German grammar for time ago which needs the :ago word be placed before the number of days/hours etc.
Example: English: 17 days ago German: vor 17 Tagen
This could be changed through diffForHumans settings as follows:
BUT unfortunately the parser replaces
:a
before replacing:ago
which leads to broken results: 17go 17 Tagen [:a]go [:a] [:w]Possible solution: Change the order in which the parser replaces :a an :ago as follows
FROM:
TO: