使用angularjs填充日期值时出错

时间:2015-12-18 05:21:32

标签: angularjs

我在日期字段

中填充日期值时收到错误

我有日期输入字段

$scope.personalDetailsObj.personalDetails.dob = $scope.kycinfo.dob;

我从这样的服务器获取DOB值,

22-06-1980

我收到错误当我尝试设置这样的值时,

android:paddingTop="?android:attr/actionBarSize"

错误说,错误:[ngModel:datefmt]预期let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WqslLLY8vLkksSVWoyU/KSk0uic9MUahRSC5KBYqlxCeWKNQoxepAFCrUGAKRob6JvpGBoamCoZWpgZWJhUKAL0xNZl58aTHQJGNkZUZWxoZWhgZYlBliKDMyQlKWkpqTCnSDQo0RsjpjK0MThHGxAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Column1 = _t]), #"Split Column by Delimiter" = Table.SplitColumn(Source,"Column1",Splitter.SplitTextByDelimiter("|", QuoteStyle.Csv),{"Column1.1", "Column1.2", "Column1.3", "Column1.4", "Column1.5"}), #"Removed Columns" = Table.RemoveColumns(#"Split Column by Delimiter",{"Column1.1", "Column1.5"}), #"Trimmed Text" = Table.TransformColumns(#"Removed Columns",{},Text.Trim), #"Promoted Headers" = Table.PromoteHeaders(#"Trimmed Text"), ChangedType = Table.TransformColumnTypes(#"Promoted Headers",{{"object_id", Int64.Type}, {"created_at", type datetime}, {"new_state", type text}}), #"Added Index" = Table.AddIndexColumn(ChangedType, "Index", 0, 1), Buffer = Table.Buffer(#"Added Index"), #"Added Custom" = Table.AddColumn(Buffer, "PreviousState", each try Buffer{[Index] - 1}[created_at] otherwise null), #"Inserted Time Subtraction" = Table.AddColumn(#"Added Custom", "TimeDifference", each [created_at] - [PreviousState], type duration) in #"Inserted Time Subtraction" 为日期

1 个答案:

答案 0 :(得分:1)

如果您使用的是moment.js(如果不使用它),请尝试使用

$scope.personalDetailsObj.personalDetails.dob = moment($scope.kycinfo.dob);

否则使用简单的javascript(不推荐)

$scope.personalDetailsObj.personalDetails.dob = new Date($scope.kycinfo.dob);

当您已经使用ng-model

时,也不需要value属性