import { set } from "https://deno.land/x/date_fns@v2.5.1/index.js";
Examples
// Transform 1 September 2014 into 20 October 2015 in a single line:
var result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
//=> Tue Oct 20 2015 00:00:00
// Transform 1 September 2014 into 20 October 2015 in a single line: var result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 }) //=> Tue Oct 20 2015 00:00:00
// Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
var result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
//=> Mon Sep 01 2014 12:23:45
// Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00: var result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 }) //=> Mon Sep 01 2014 12:23:45