luxon#DateTimeFormatOptions TypeScript Examples

The following examples show how to use luxon#DateTimeFormatOptions. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utilsv5.ts    From dendron with GNU Affero General Public License v3.0 7 votes vote down vote up
static getFM(opts: { note: NoteProps; wsRoot: string }) {
    const { note, wsRoot } = opts;

    const custom = note.custom ? note.custom : undefined;

    const ws = new WorkspaceService({ wsRoot });
    const wsConfig = ws.getCodeWorkspaceSettingsSync();
    ws.dispose();
    const timestampConfig: keyof typeof DateTime =
      wsConfig?.settings["dendron.defaultTimestampDecorationFormat"];
    const formatOption = DateTime[timestampConfig] as
      | DateTimeFormatOptions
      | undefined;
    const created = DateTime.fromMillis(_.toInteger(note.created));
    const updated = DateTime.fromMillis(_.toInteger(note.updated));

    return {
      ...custom,
      id: note.id,
      title: note.title,
      desc: note.desc,
      created: created.toLocaleString(formatOption),
      updated: updated.toLocaleString(formatOption),
    };
  }