Javascript上的长日期格式 - PDF戳

问题描述 投票:-1回答:1

新的,我正在创建一个“交互式”标记,需要PDF标记上的“长日期格式”。

目前,这是我的代码:

var builder = 
{
	// These map to Text Fields in the Stamp
	textBoxes :
	[
		{ field:"CheckedBy", description:"By:", default:function() { return ""; } },
		{ field:"ProjectNumber", description:"ProjectNumber", default:function() { return ""; } },
		{ field:"Date", description:"Date:", default:function() 
			{  
				var curDate = new Date();
				return (curDate.getMonth() + 1) + "." + curDate.getDate() + "," + curDate.getFullYear();
			} 
	
		}
	],
	// This maps to a Radio Group in the PDF named 'Status'
	radioGroup : "Status",	
	radioButtons :
	[
		// value maps to the 'Choice' of each radio button in the group, description will show on the dialog
		{ value:"Reviewed", description:"Reviewed" },
		{ value:"ReviseasNoted", description:"Revise as Noted" },
		{ value:"ReviseandResubmit", description:"Revise and Resubmit" },
		{ value:"NotReviewed", description:"Not Reviewed" },
	],
	radioErrorMsg : "Please select a status"
}

这将返回日期08.09,2018,但我需要更改日期格式,因此它是“2018年9月05日”我尝试了很多建议,但我似乎可以让它工作。有人能指出我正确的方向吗?

javascript date-format
1个回答
0
投票

我会用Momentjs来做这件事。为了实现你的目标,你可以做到这一点:

let dateToday = new Date() moment(dateToday).format("MMM. DD, YYYY")

© www.soinside.com 2019 - 2024. All rights reserved.