Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@internationalized/date
Advanced tools
Readme
The @internationalized/date
package provides objects and functions for representing and manipulating dates and times in a locale-aware manner.
CalendarDate
methods, it's just 2.8 kB.Dates and times are represented in many different ways by cultures around the world. This includes differences in calendar systems, time zones, daylight saving time rules, date and time formatting, weekday and weekend rules, and much more. When building applications that support users around the world, it is important to handle these aspects correctly for each locale. The @internationalized/date
package provides a library of objects and functions to perform date and time related manipulation, queries, and conversions that work across locales and calendars.
By default, JavaScript represents dates and times using the Date object. However, Date
has many problems, including a very difficult to use API, lack of all internationalization support, and more. The Temporal proposal will eventually address this in the language, and @internationalized/date
is heavily inspired by it. We hope to back the objects in this package with it once it is implemented in browsers.
The @internationalized/date
package includes the following object types:
Each object includes methods to allow basic manipulation and conversion functionality, such as adding and subtracting durations, and formatting as an ISO 8601 string. Additional less commonly used functions can be imported from the @internationalized/date
package, and passed a date object as a parameter. This includes functions to parse ISO 8601 strings, query properties such as day of week, convert between time zones and much more. See the documentation for each of the objects to learn more about the supported methods and functions.
This example constructs a CalendarDate
object, manipulates it to get the start of the next week, and converts it to a string representation.
import {CalendarDate, startOfWeek} from '@internationalized/date';
let date = new CalendarDate(2022, 2, 3);
date = date.add({weeks: 1});
date = startOfWeek(date, 'en-US');
date.toString(); // 2022-02-06
FAQs
Internationalized calendar, date, and time manipulation utilities
The npm package @internationalized/date receives a total of 957,023 weekly downloads. As such, @internationalized/date popularity was classified as popular.
We found that @internationalized/date demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.