Questions tagged [date-pipe]

Angular's date pipe that transforms a date into various formats.

119 questions
5
votes
1 answer

How to set the value of date input field using data binding in Angular 5?

I have two date input fields (fromDate & toDate) in my angular application. I also 3 buttons 'Yesterday', 'Last Week', 'Last Month'. The user can either choose both 'from' and 'to' dates or they can press one of the buttons. As soon as a button is…
Bhargav Raju
  • 161
  • 1
  • 2
  • 16
5
votes
2 answers

Angular2 date pipe automatically adding timezone to date

I have a date string, like this 1987-06-15T00:00:00.000Z, when I am added date pipe on it the date is showing a different date like Jun 14, 1987 in American time zone, but in India, it's showing correct.
{{'1987-06-15T00:00:00.000Z' |…
byteC0de
  • 5,153
  • 5
  • 33
  • 66
4
votes
1 answer

Angular - using a date pipe with ngModel

I am getting the following error in my console - "Error: InvalidPipeArgument: 'Unable to convert "[object Object]" into a date' for pipe 'DatePipe'". I have a calendar input, which should allow the user to select a date and then pass on that date in…
Robgit28
  • 268
  • 4
  • 18
4
votes
2 answers

Angular 4 date pipe, no timezone

I'm using date pipe to display record date to user on front-end. Back-end get's the date from DB and through rest I'm getting this from server to front-end. And there I use :
{{myDate | date:'dd-MM-yyyy HH:mm:ss'}}
The problem is, this…
3
votes
1 answer

Dates timezones in Angular

In an Angular app, I have a form and I want the user to be able to create a Date in any timezone. The user inputs: date: 20/09/2021 hour: 10:30 timezone (select): Europe/Madrid What I did was saving in a local file the relationship between…
adrisons
  • 3,443
  • 3
  • 32
  • 48
3
votes
1 answer

Angular 6 - Date pipe

could some one tell how to achieve below format in angular?. expected: 20JAN2019 right now with angular default pipe. am getting like 20/01/2019 when using {{slotEndDate | date:'dd/MM/yyyy'}} do i need write custom pipe to get desired…
Mr. Learner
  • 978
  • 2
  • 18
  • 48
3
votes
2 answers

Angular date pipe custom output

If you take a look in Angular's DatePipe documentation you'll see at the pre-defined format options there's a 'long' format that looks like this: June 15, 2015 at 9:03:01 AM GMT+1 I want to achieve the same thing but without the timezone. Eg: 08…
Barnee
  • 3,212
  • 8
  • 41
  • 53
3
votes
1 answer

date pipe angular 4 custom format with timezone (short)

I need to print timestamp custom format with timezone (short format): {{ '2017-06-29 09:55:01.956-0400' | date:'MMM dd, y hh:mm a' }} Output: Jun 29, 2017 07:25 PM But I need to append with timezone, for example: Jun 29, 2017 07:25 PM…
mperle
  • 3,342
  • 8
  • 20
  • 34
2
votes
1 answer

Angular 15 DatePipe Class with Time Zone Offset

In my Angular 15 app, I am currently overriding the default time zone using an injection token method as suggested by Core Team. It works as expected but here's the catch. I have edge case implementations where DatePipe is used directly on the…
markreyes
  • 1,249
  • 1
  • 13
  • 27
2
votes
1 answer

dd/mm/yyyy format for datepipe.transform method in .ts file

I am parsing a csv file which has a date column in dd/mm/yyyy format. The format of the date needs to be transformed to yyyy-mm-dd before saving it to the database. So I am using datepipe.transform method for this as…
Anupriya
  • 23
  • 1
  • 5
2
votes
1 answer

Formatting Date with month names in different languages using date pipe

I am displaying date in html like this {{ item.lastModified | date : 'MMM d, y' }} So the date displays something like this Jul 20, 2021 Now when I change my browser language I need the month to change to that language the language…
dev_101
  • 321
  • 4
  • 14
2
votes
0 answers

Angular Decimal Pipe locale dependend on browser

I am using a DecimalPipe in my Angular application to display numbers, but the problem is that the default locale for the decimal pipe is 'en-us'. Thus the number one million is formatted as 1,000,000. I however am a European and I want it to be 1…
2
votes
1 answer

Angular and date from PHP InvalidPipeArgument: 'Unable to convert "[object Object]" into a date' for pipe 'DatePipe'

I have application written in Angular 9 and api written in PHP. From controller in PHP I return list of objects with property finishDate. In PHP finishDate is assign to DateTime: $timeSheetsOrderDTO1 = new…
Robert
  • 343
  • 1
  • 3
  • 14
2
votes
3 answers

How to get monthname from number using angular datepipe

I want to display a dropdown containing (localized) month names by using angular's datepipe. months is an array of…
TheDoctor
  • 2,362
  • 4
  • 22
  • 39
2
votes
1 answer

Why angular date pipe do not support locale language default format like Intl.DateTimeFormat?

I am using angular date pipe for date formatting. I want to format date based on user/client locale. For example 'mm/dd/yyyy' for English US(en-US) and dd.mm.yyyy for German(de-de). Angular have format options like short, medium and long. They do…
srinivas
  • 109
  • 1
  • 3
  • 14