-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hey @cormacrelf.
While it's not formally part of the spec, thought I might suggest including this anyway, per EDTF.js.
Also, on a simpler note, can you show how to format the parsed dates, and maybe add it to the usage section?
I'm wanting to implement localized level 1 support in a project I'm working on, and am lost.
Here's the typescript prototype code I'm wanting to convert to Rust:
formatDate(date: string, options: Intl.DateTimeFormatOptions): string {
const parsedDate = edtf.default(date);
const year = parsedDate.year.toString();
const optKeys = Object.keys(options);
const useYear = optKeys.includes("year") && optKeys.length === 1;
const formattedDate = useYear
? year
: edtf.format(parsedDate, "en-US", options);
return formattedDate;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels