Skip to content

Instantly share code, notes, and snippets.

@basarat
Last active February 21, 2022 22:02

Revisions

  1. basarat revised this gist Feb 21, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion demo.ts
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,6 @@ function tomorrow(date: Date) {
    return add(date, { days: 1 });
    }

    const now = new Date(2022, 3, 3);
    const now = new Date('2022-04-03 00:00:00');
    const next = tomorrow(now);
    console.log(now.toLocaleString(), '--', next.toLocaleString());
  2. basarat created this gist Feb 21, 2022.
    10 changes: 10 additions & 0 deletions demo.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    import { add } from 'date-fns';

    /** Add one day to a given input */
    function tomorrow(date: Date) {
    return add(date, { days: 1 });
    }

    const now = new Date(2022, 3, 3);
    const next = tomorrow(now);
    console.log(now.toLocaleString(), '--', next.toLocaleString());