Skip to content

Integrate a lighter datetime formatter with i18n support #9833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jperucello opened this issue Apr 13, 2021 · 2 comments
Closed

Integrate a lighter datetime formatter with i18n support #9833

jperucello opened this issue Apr 13, 2021 · 2 comments
Labels
external-packages feature Initiative All feature requests that will be taken up as a new initiative product/api-client product/runtime sandbox

Comments

@jperucello
Copy link

Is your feature request related to a problem? Please describe.
Moment.js is now deprecated, cannot handle timezone when running on Monitors / Newman and it's heavy.

Describe the solution you'd like
I'd like to have a non-deprecated and lighter library to manipulate date+timestamp AND timezone on Postman

Describe alternatives you've considered

@giridharvc7 giridharvc7 added the Initiative All feature requests that will be taken up as a new initiative label Apr 19, 2021
@ItalyPaleAle
Copy link

Found this issue as I'm interested in date-fns (or any other moment alternative) as well. Is there any update?

@appurva21
Copy link
Member

Hey folks!

Postman now supports importing external packages from NPM directly into your scripts. You can now use any package of your preference to work with dates and times:

luxon:

const { DateTime } = pm.require("npm:luxon");

function logTime(zone, label) {
  const time = DateTime.now().setZone(zone);
  console.log(`Current time in ${label}:`, time.toFormat("yyyy-MM-dd HH:mm:ss ZZZZ"));
}

logTime("Asia/Kolkata", "India");
logTime("America/New_York", "NY");

Image

date-fns:

const dateFns = pm.require('npm:date-fns');

dayjs:

const dayjs = pm.require('npm:dayjs');

For more on how to use external packages in scripts, check out: #13542

Note: We don’t plan to support this in newman, but it will be available soon in the Postman CLI and Monitors.

I’ll close this ticket for now — feel free to open a new one if you run into anything or this does not fulfill your use case. 🚀

@appurva21 appurva21 mentioned this issue Apr 15, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-packages feature Initiative All feature requests that will be taken up as a new initiative product/api-client product/runtime sandbox
Projects
None yet
Development

No branches or pull requests

5 participants