# node-date-only **Repository Path**: mirrors_felixfbecker/node-date-only ## Basic Information - **Project Name**: node-date-only - **Description**: Use Temporal.PlainDate instead - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-03-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Useful when you get date-only values from you DB and want to have them as Date objects in your model, but stringify to YYYY-MM-DD for your JSON API consumers. ```js const DateOnly = require('date-only'); const dateOnly = new DateOnly(); console.log(JSON.stringify(dateOnly)); // "2016-01-07" console.log(dateOnly.toISOString()); // 2016-01-07 // pass DateOnly instance to Date to convert to normal date const normalDate = new Date(dateOnly); console.log(JSON.stringify(normalDate)); // 2016-01-07T12:34:13.769Z // pass normal date to DateOnly to convert to DateOnly dateOnly = new DateOnly(normalDate); console.log(JSON.stringify(dateOnly)); // "2016-01-07" ```