文件操作 - formatToDateTimeLocalInput.ts
返回文件管理
返回主菜单
删除本文件
文件: /home/www/public/wp-content/plugins/give/src/Admin/common/formatToDateTimeLocalInput.ts
编辑文件内容
import {dateI18n, getDate} from '@wordpress/date'; /** * Format the date and time to a datetime-local input compatible string * @since 4.13.0 */ export default function formatToDateTimeLocalInput(dateString: string) { if (!dateString) { return ''; } // Interpret server-provided naive strings as site timezone (WordPress timezone), // and preserve the wall time for the datetime-local input. const dateObj = getDate(dateString); if (isNaN(dateObj.getTime())) { return ''; } return dateI18n('Y-m-d\\TH:i', dateObj, undefined); }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件