Title: iOS 开发中日期判断 · Issue #6 · aTreey/aTreey.github.io · GitHub
Open Graph Title: iOS 开发中日期判断 · Issue #6 · aTreey/aTreey.github.io
X Title: iOS 开发中日期判断 · Issue #6 · aTreey/aTreey.github.io
Description: iOS中日期有非常好用DateTools 库,但是有时候就需要判断是否是同一天/同一月/同一年,直接使用系统 Calendar 提供的方法就可以满足 // 比较两个日期,通过Calendar.Component 指定时间精度 public func compare(_ date1: Date, to date2: Date, toGranularity component: Calendar.Component) -> ComparisonResult // 两个日期是...
Open Graph Description: iOS中日期有非常好用DateTools 库,但是有时候就需要判断是否是同一天/同一月/同一年,直接使用系统 Calendar 提供的方法就可以满足 // 比较两个日期,通过Calendar.Component 指定时间精度 public func compare(_ date1: Date, to date2: Date, toGranularity component: Calendar...
X Description: iOS中日期有非常好用DateTools 库,但是有时候就需要判断是否是同一天/同一月/同一年,直接使用系统 Calendar 提供的方法就可以满足 // 比较两个日期,通过Calendar.Component 指定时间精度 public func compare(_ date1: Date, to date2: Date, toGranularity component: Calendar...
Opengraph URL: https://github.com/aTreey/aTreey.github.io/issues/6
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"iOS 开发中日期判断","articleBody":"iOS中日期有非常好用DateTools 库,但是有时候就需要判断是否是同一天/同一月/同一年,直接使用系统 Calendar 提供的方法就可以满足\r\n\r\n```\r\n // 比较两个日期,通过Calendar.Component 指定时间精度\r\npublic func compare(_ date1: Date, to date2: Date, toGranularity component: Calendar.Component) -\u003e ComparisonResult\r\n// 两个日期是否在同一天,通过Calendar.Component 指定时间精度\r\npublic func isDate(_ date1: Date, equalTo date2: Date, toGranularity component: Calendar.Component) -\u003e Bool\r\n// 两个日期是否是同一天\r\npublic func isDate(_ date1: Date, inSameDayAs date2: Date) -\u003e Bool\r\n// 是否是今天范围\r\npublic func isDateInToday(_ date: Date) -\u003e Bool\r\n// 是否在昨天范围\r\npublic func isDateInYesterday(_ date: Date) -\u003e Bool\r\n// 是否在明天范围\r\npublic func isDateInTomorrow(_ date: Date) -\u003e Bool\r\n// 是否在本周范围\r\npublic func isDateInWeekend(_ date: Date) -\u003e Bool\r\n```","author":{"url":"https://github.com/aTreey","@type":"Person","name":"aTreey"},"datePublished":"2018-07-18T02:20:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/6/aTreey.github.io/issues/6"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a6e65da1-af05-f6bf-a154-a18782a259f4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E69A:3020D:41505AD:5C66C1C:6A56B7AE |
| html-safe-nonce | 3bba4447d591c738158ad196eabc46249a3ce56dd78315439cc7b237c694018c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjlBOjMwMjBEOjQxNTA1QUQ6NUM2NkMxQzo2QTU2QjdBRSIsInZpc2l0b3JfaWQiOiI0NDE1OTIwMDE0OTk1NDA0NzE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c357884c4ab7a211c613e816fecd486b9221ffffe4636208a77bc7d2a40b540a |
| hovercard-subject-tag | issue:342151643 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/aTreey/aTreey.github.io/6/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cd425ba31789f118d9aab651fdf7fae40cb7d5ac1387dc5d1079db5d95f377f8/aTreey/aTreey.github.io/issues/6 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cd425ba31789f118d9aab651fdf7fae40cb7d5ac1387dc5d1079db5d95f377f8/aTreey/aTreey.github.io/issues/6 |
| og:image:alt | iOS中日期有非常好用DateTools 库,但是有时候就需要判断是否是同一天/同一月/同一年,直接使用系统 Calendar 提供的方法就可以满足 // 比较两个日期,通过Calendar.Component 指定时间精度 public func compare(_ date1: Date, to date2: Date, toGranularity component: Calendar... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | aTreey |
| hostname | github.com |
| expected-hostname | github.com |
| None | df99b7164e1d961b639cf5d3cbd6b5ba673edc67bd7e47cdc4746b96099e11ae |
| turbo-cache-control | no-preview |
| go-import | github.com/aTreey/aTreey.github.io git https://github.com/aTreey/aTreey.github.io.git |
| octolytics-dimension-user_id | 14048652 |
| octolytics-dimension-user_login | aTreey |
| octolytics-dimension-repository_id | 125624771 |
| octolytics-dimension-repository_nwo | aTreey/aTreey.github.io |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 125624771 |
| octolytics-dimension-repository_network_root_nwo | aTreey/aTreey.github.io |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c29ba03b1896083dbe1084f6cd1c5367d8a0d67c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width