Skip to content

Commit 3ede017

Browse files
committed
Update README
1 parent 8f438f7 commit 3ede017

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
- Add FormatStyle & Mutability & Sendability & Inlinable by @lvalenta in https://github.com/CreateAPI/NaiveDate/pull/6
99
- Add support for Swift 6
10+
- Increase minimimum supported platforms to iOS 13, tvOS 13, watchOS 6, and macOS 10.15
1011

1112
## NaiveDate 1.0
1213

README.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Native `Date` type is great for working with time zones (e.g. `2017-09-29T15:00:
1212

1313
The `NaiveDate` library implements three types:
1414

15-
- `NaiveDate` (e.g. `2021-09-29`)
15+
- `NaiveDate` (e.g. `2024-09-29`)
1616
- `NaiveTime` (e.g. `15:30:00`)
17-
- `NaiveDateTime` (e.g. `2021-09-29T15:30:00` - no time zone and no offset).
17+
- `NaiveDateTime` (e.g. `2024-09-29T15:30:00` - no time zone and no offset).
1818

1919
They all implement `Equatable`, `Comparable`, `LosslessStringConvertible`, and `Codable` protocols. Naive date types can also be converted to `Date`, and `DateComponents`.
2020

@@ -23,15 +23,15 @@ They all implement `Equatable`, `Comparable`, `LosslessStringConvertible`, and `
2323
Naive dates and times can be created from a string (using a predefined format – [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339#section-5.6), using `Decodable`, or with a memberwise initializer:
2424

2525
```swift
26-
NaiveDate("2021-10-01")
27-
NaiveDate(year: 2021, month: 10, day: 1)
26+
NaiveDate("2024-10-01")
27+
NaiveDate(year: 2024, month: 10, day: 1)
2828

2929
NaiveTime("15:30:00")
3030
NaiveTime(hour: 15, minute: 30, second: 0)
3131

32-
NaiveDateTime("2021-10-01T15:30")
32+
NaiveDateTime("2024-10-01T15:30")
3333
NaiveDateTime(
34-
date: NaiveDate(year: 2021, month: 10, day: 1),
34+
date: NaiveDate(year: 2024, month: 10, day: 1),
3535
time: NaiveTime(hour: 15, minute: 30, second: 0)
3636
)
3737
```
@@ -41,51 +41,50 @@ NaiveDateTime(
4141
Format dates without having to worry about time zones:
4242

4343
```swift
44-
let date = NaiveDate("2021-11-01")!
44+
let date = NaiveDate("2024-11-01")!
4545
NaiveDateFormatter(dateStyle: .short).string(from: date)
46-
// prints "Nov 1, 2021"
46+
// prints "Nov 1, 2024"
4747

4848
let time = NaiveTime("15:00")!
4949
NaiveDateFormatter(timeStyle: .short).string(from: time)
5050
// prints "3:00 PM"
5151

52-
let dateTime = NaiveDateTime("2021-11-01T15:30:00")!
52+
let dateTime = NaiveDateTime("2024-11-01T15:30:00")!
5353
NaiveDateFormatter(dateStyle: .short, timeStyle: .short).string(from: dateTime)
54-
// prints "Nov 1, 2021 at 3:30 PM"
54+
// prints "Nov 1, 2024 at 3:30 PM"
5555
```
5656

5757
### Convert
5858

5959
When you do need to work with time zones, simply convert `NaiveDate` to `Date`:
6060

6161
```swift
62-
let date = NaiveDate(year: 2021, month: 10, day: 1)
62+
let date = NaiveDate(year: 2024, month: 10, day: 1)
6363

6464
// Creates `Date` in a calendar's time zone
65-
// "2021-10-01T00:00:00+0300" if user is in MSK
65+
// "2024-10-01T00:00:00+0300" if user is in MSK
6666
Calendar.current.date(from: date)
6767
```
6868

6969
```swift
7070
let dateTime = NaiveDateTime(
71-
date: NaiveDate(year: 2021, month: 10, day: 1),
71+
date: NaiveDate(year: 2024, month: 10, day: 1),
7272
time: NaiveTime(hour: 15, minute: 30, second: 0)
7373
)
7474

7575
// Creates `Date` in a calendar's time zone
76-
// "2021-10-01T15:30:00+0300" if user is in MSK
76+
// "2024-10-01T15:30:00+0300" if user is in MSK
7777
Calendar.current.date(from: dateTime)
7878
```
7979

8080
**Important!** The naive types are called this way because they don’t have a time zone associated with them. This means the date may not actually exist in some areas in the world, even though they are “valid”. For example, when daylight saving changes are applied the clock typically moves forward or backward by one hour. This means certain dates never occur or may occur more than once. If you need to do any precise manipulations with time, always use native `Date` and `Calendar`.
8181

8282
## Minimum Requirements
8383

84-
| NaiveDate | Swift | Xcode | Platforms |
85-
|----------------------|-----------------------|----------------------|---------------------------------------------------|
86-
| NaiveDate 1.0 | Swift 5.3 | Xcode 12.0 | iOS 11.0 / watchOS 4.0 / macOS 10.13 / tvOS 11.0 |
87-
| NaiveDate 0.4 | Swift 4.2 – 5.0 | Xcode 10.1 – 10.2 | iOS 10.0 / watchOS 3.0 / macOS 10.12 / tvOS 10.0 |
88-
| NaiveDate 0.3 | Swift 4.0 – 4.2 | Xcode 9.2 – 10.1 | iOS 10.0 / watchOS 3.0 / macOS 10.12 / tvOS 10.0 |
84+
| NaiveDate | Swift | Platforms |
85+
|----------------------|------------------|--------------------------------------------|
86+
| NaiveDate 1.1 | Swift 5.9 | iOS 13, tvOS 13, watchOS 6, macOS 10.15 |
87+
| NaiveDate 1.0 | Swift 5.3 | iOS 11, tvOS 11, watchOS 4, macOS 10.13, |
8988

9089
## License
9190

0 commit comments

Comments
 (0)