manual parsing of date to avoid UTC issues
This commit is contained in:
parent
8d263f3d78
commit
90048fcd22
|
|
@ -3419,7 +3419,14 @@ function noteApp() {
|
||||||
|
|
||||||
// Format dates nicely
|
// Format dates nicely
|
||||||
if (key === 'date' || key === 'created' || key === 'modified' || key === 'updated') {
|
if (key === 'date' || key === 'created' || key === 'modified' || key === 'updated') {
|
||||||
const date = new Date(value);
|
let date;
|
||||||
|
// Parse date-only strings (YYYY-MM-DD) as local dates to avoid timezone issues
|
||||||
|
if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
||||||
|
const [year, month, day] = value.split('-').map(Number);
|
||||||
|
date = new Date(year, month - 1, day); // month is 0-indexed
|
||||||
|
} else {
|
||||||
|
date = new Date(value);
|
||||||
|
}
|
||||||
if (!isNaN(date.getTime())) {
|
if (!isNaN(date.getTime())) {
|
||||||
return date.toLocaleDateString('en-US', {
|
return date.toLocaleDateString('en-US', {
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue