Search Posts

Category: date

Add date format into date regex

I am getting date format like this /Date(1495111091673)/.I have created one custom filter to change date format. app.filter(‘jsonDate’, function () { return function (date) { return new Date(date.match(/d+/)[0] * 1); } }) This filter returns date like this. Thu May 18 2017 18:08:11 GMT+0530 (India Standard Time) But I want it as standard format like dd/MM/yyyy so I have edited my filter code like this: app.filter(‘jsonDate’, function () { return function (date) { return new […]

How to filter Date format "2016-09-12 11:21:50 BRT" to format dd/MM/yyyy on Datatable or Angular Controller?

I need convert a date from back-end (JAVA) to front-end (Angular), the format date is “2016-09-12 11:21:50 BRT” or “2016-09-12 11:21:50 BRST”. I using a datatable javascript to populate a table on front-end. I need a filter for datatable or angular controller, I try used $filter of Angular, but did not work. Source: AngularJS

Allowing empty values in HTML5 date input

If I use an HTML5 date input and that field represents a date that maps to a nullable datetime column in the database, how do I get around setting an empty value in the input field? My application is using AngularJS and my ng-model is mapping to a scope variable with an initial value of null (or an empty string). Here’s what the browser’s console says: Error: [ngModel:datefmt] at angular.js:88 at Array.<anonymous> (angular.js:25308) at […]

Javascript new Date function producing different hour values for two similar function calls [duplicate]

This question already has an answer here: Why does Date.parse give incorrect results? 9 answers I have an angular.js application, and I want to get the dates of Monday and Sunday of the current week, which are then set to calendar dates by default. I was looking at an error due to the produced dates not falling within 7 days time span. I fixed the issue. But as I was playing around with the code […]

Formatting Sql Date Value to Date only using angularjs

In my Sql Server I have a column that has a date data type and here is a sample 2017-09-28. I created a model with this as display format: [Display(Name = “Enroll Date”)] [DisplayFormat(DataFormatString = “{0:dd/MM/yyyy}”, ApplyFormatInEditMode = true)] public DateTime CreationDate { get; set; } and a controller in my angular controller: var app = angular.module(“MyApp”, []); app.controller(“PdfController”, function($scope, $http) { $scope.message = “”; $scope.records = null; $http({ method: ‘GET’, url: ‘/Pdf/GetData’ }).then(function(result) { […]

Different rule for same Date object on datepicker

this is the continuation of this question. Basically i have an array of dates and i want them to be modifiable by the user, so i loop through the array and bind the dates to a datepicker. the dates are retrieved by an API and processed this way : function(date) { const dateAndTime = date.split(‘ ‘), dateParts = dateAndTime[0].split(‘-‘); dateParts.reverse(); var finalDate = dateParts.join(‘-‘) + ‘ ‘ + dateAndTime[1] + ‘.000’; return new Date(finalDate); } […]

Invalid date DatePicker

I’m pretty stucked on this problem where i have an api that return some data, in this format { “data”: { “result”: [ { “start_date”: “03-08-2017 00:00:00”, “end_date”: “01-09-2017 23:59:59” }, { “start_date”: “01-01-2017 00:00:00”, “end_date”: “31-12-2017 23:59:59″ } ] } } I want to take these data and make them modifiable by the user, so basically my html is something like that: <table class=”table” > <thead> <tr> <th class=”col-order”>{{‘START_DATE’| translate}}</th> <th class=”col-order”>{{‘END_DATE’| translate}}</th> </tr> […]