Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/date_fns/index.js>set

date-fns Deno package
Go to Latest
function set
import { set } from "https://deno.land/x/date_fns@v2.12.0/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

// 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

Parameters

dirtyDate
  • the date to be changed
values
  • an object with options