W3cubDocs

/date-fns

endOfDay

Return the end of a day for the given date.

Description

Return the end of a day for the given date. The result will be in the local timezone.

Usage

// CommonJS
var endOfDay = require('date-fns/endOfDay')
// ES 2015
import endOfDay from 'date-fns/endOfDay'
// ESM
import { endOfDay } from 'date-fns'

Syntax

endOfDay(date)

Arguments

Name Description
date

the original date

Returns

Description

the end of a day

Exceptions

Type Description
TypeError

1 argument required

Examples

// The end of a day for 2 September 2014 11:55:00:
const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
//=> Tue Sep 02 2014 23:59:59.999

© 2021 Sasha Koss and Lesha Koss
Licensed under the MIT License.
https://date-fns.org/v2.29.2/docs/endOfDay