久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='ON0SI'></tfoot>
    1. <legend id='ON0SI'><style id='ON0SI'><dir id='ON0SI'><q id='ON0SI'></q></dir></style></legend>
      <i id='ON0SI'><tr id='ON0SI'><dt id='ON0SI'><q id='ON0SI'><span id='ON0SI'><b id='ON0SI'><form id='ON0SI'><ins id='ON0SI'></ins><ul id='ON0SI'></ul><sub id='ON0SI'></sub></form><legend id='ON0SI'></legend><bdo id='ON0SI'><pre id='ON0SI'><center id='ON0SI'></center></pre></bdo></b><th id='ON0SI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ON0SI'><tfoot id='ON0SI'></tfoot><dl id='ON0SI'><fieldset id='ON0SI'></fieldset></dl></div>

        <small id='ON0SI'></small><noframes id='ON0SI'>

        • <bdo id='ON0SI'></bdo><ul id='ON0SI'></ul>

        將 gregorian 日期轉換為 angular 2 和 Ionic 2 中的波斯

        Convert gregorian date to persian(jalali) date in angular 2 and Ionic 2(將 gregorian 日期轉換為 angular 2 和 Ionic 2 中的波斯(jalali)日期)
          <tbody id='ZHnwH'></tbody>
        • <bdo id='ZHnwH'></bdo><ul id='ZHnwH'></ul>

            <tfoot id='ZHnwH'></tfoot>
                <legend id='ZHnwH'><style id='ZHnwH'><dir id='ZHnwH'><q id='ZHnwH'></q></dir></style></legend>
              1. <small id='ZHnwH'></small><noframes id='ZHnwH'>

                <i id='ZHnwH'><tr id='ZHnwH'><dt id='ZHnwH'><q id='ZHnwH'><span id='ZHnwH'><b id='ZHnwH'><form id='ZHnwH'><ins id='ZHnwH'></ins><ul id='ZHnwH'></ul><sub id='ZHnwH'></sub></form><legend id='ZHnwH'></legend><bdo id='ZHnwH'><pre id='ZHnwH'><center id='ZHnwH'></center></pre></bdo></b><th id='ZHnwH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ZHnwH'><tfoot id='ZHnwH'></tfoot><dl id='ZHnwH'><fieldset id='ZHnwH'></fieldset></dl></div>

                  本文介紹了將 gregorian 日期轉換為 angular 2 和 Ionic 2 中的波斯(jalali)日期的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我熟悉位于 npm 中的一個包,用于將公歷日期轉換為波斯語 (jalali),但我不知道應該如何在 ionic 2 angular 2 項目中使用它.

                  I'm familiar with one package located in npm for converting gregorian date to persian (jalali), but i don't know how should i use it in ionic 2 angular 2 projects.

                  Jalali-date

                  或角度 1 的這個包:

                  or this package for angular 1:

                  ADM-dateTimePicker

                  是否可以將此包轉換為 angular 2?任何的想法?歡迎或教程...

                  is it possible to convert this package to angular 2? any idea? or tutorial are welcome...

                  推薦答案

                  好的,我為此寫了轉換器,

                  ok, i wrote convertor for this purpose,

                  首先在你的項目中添加一個提供者:

                  first add a provider in your project:

                  import {Injectable} from '@angular/core';
                  @Injectable()
                  export class PersianCalendarService {
                    weekDayNames: string[] = ["????", "??????", "??????",
                      "?? ????", "????????",
                      "??? ????", "????"];
                    monthNames: string[] = [
                      "???????",
                      "????????",
                      "?????",
                      "???",
                      "?????",
                      "??????",
                      "???",
                      "????",
                      "???",
                      "??",
                      "????",
                      "?????"];
                    strWeekDay: string = null;
                    strMonth: string = null;
                    day: number = null;
                    month: number = null;
                    year: number = null;
                    ld: number = null;
                    farsiDate: string = null;
                  
                    today: Date = new Date();
                  
                    gregorianYear = null;
                    gregorianMonth = null;
                    gregorianDate = null;
                    WeekDay = null;
                    buf1: number[] = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
                    buf2: number[] = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
                  
                    constructor() {
                    }
                    PersianCalendar(gregorianDate): string {
                      this.today = gregorianDate;
                      this.gregorianYear = this.today.getFullYear();
                      this.gregorianMonth = this.today.getMonth() + 1;
                      this.gregorianDate = this.today.getDate();
                      this.WeekDay = this.today.getDay();
                      this.toPersian(gregorianDate);
                      return this.strWeekDay + " " + this.day + " " + this.strMonth + " " + this.year;
                  
                  
                    }
                    toPersian(gregorianDate) {
                      if ((this.gregorianYear % 4) != 0)
                        this.farsiDate = this.func1();
                      else
                        this.farsiDate = this.func2();
                      this.strMonth = this.monthNames[Math.floor(this.month - 1)];
                      this.strWeekDay = this.weekDayNames[this.WeekDay + 1];
                  
                    }
                  
                  
                    func1(): string {
                      this.day = this.buf1[this.gregorianMonth - 1] + this.gregorianDate;
                      if (this.day > 79) {
                        this.day = this.day - 79;
                        if (this.day <= 186) {
                          var day2 = this.day;
                          this.month = (day2 / 31) + 1;
                          this.day = (day2 % 31);
                          if (day2 % 31 == 0) {
                            this.month--;
                            this.day = 31;
                          }
                          this.year = this.gregorianYear - 621;
                        }
                        else {
                          var day2 = this.day - 186;
                          this.month = (day2 / 30) + 7;
                          this.day = (day2 % 30);
                          if (day2 % 30 == 0) {
                            this.month = (day2 / 30) + 6;
                            this.day = 30;
                          }
                          this.year = this.gregorianYear - 621;
                        }
                      }
                      else {
                        this.ld = this.gregorianYear > 1996 && this.gregorianYear % 4 == 1 ? 11 : 10;
                        var day2 = this.day + this.ld;
                        this.month = (day2 / 30) + 10;
                        this.day = (day2 % 30);
                        if (day2 % 30 == 0) {
                          this.month--;
                          this.day = 30;
                        }
                        this.year = this.gregorianYear - 622;
                      }
                      var fullDate = this.day + "/" + Math.floor(this.month) + "/" + this.year;
                      return fullDate
                    }
                  
                  
                  
                    func2(): string {
                      //console.log("entered func2");
                      this.day = this.buf2[this.gregorianMonth - 1] + this.gregorianDate;
                      this.ld = this.gregorianYear >= 1996 ? 79 : 80;
                      if (this.day > this.ld) {
                        this.day = this.day - this.ld;
                        if (this.day <= 186) {
                          var day2 = this.day;
                          this.month = (day2 / 31) + 1;
                          this.day = (day2 % 31);
                          if (day2 % 31 == 0) {
                            this.month--;
                            this.day = 31;
                          }
                          this.year = this.gregorianYear - 621;
                        } else {
                          var day2 = this.day - 186;
                          this.month = (day2 / 30) + 7;
                          this.day = (day2 % 30);
                          if (day2 % 30 == 0) {
                            this.month--;
                            this.day = 30;
                          }
                          this.year = this.gregorianYear - 621;
                        }
                        var fullDate = this.day + "/" + Math.floor(this.month) + "/" + this.year;
                        return fullDate
                      }
                      else {
                        var day2 = this.day + 10;
                        this.month = (day2 / 30) + 10;
                        this.day = (day2 % 30);
                        if (day2 % 30 == 0) {
                          this.month--;
                          this.day = 30;
                        }
                        this.year = this.gregorianYear - 622;
                      }
                    }
                  }
                  

                  下一步:在您的代碼中導入此服務:

                  the next step: import this service in your code:

                  import {PersianCalendarService} from '../../providers/persian-calendar-service/persian-calendar-service';
                  

                  下一步:在 @Page 部分實現提供者的名稱

                  the next step: implement the provider's name in @Page section

                  @Page({
                    templateUrl: 'build/pages/getting-started/getting-started.html',
                    providers: [PersianCalendarService]
                  })
                  

                  構造函數

                  constructor(
                     public persianCalendarService: PersianCalendarService) {}
                  

                  那么您只需將日期傳遞給函數以獲得良好的 Jalali 日期輸出:

                  then just you need to pass the date to the function for getting a nice output of Jalali date:

                   getJalaliDate(date) {
                  var date1 = this.persianCalendarService.PersianCalendar(date);
                  this.farsiDate = date1;
                  

                  }

                  我會盡快將這段代碼添加到 github 中.謝謝

                  i'll add this code in github soon. Thanks

                  這篇關于將 gregorian 日期轉換為 angular 2 和 Ionic 2 中的波斯(jalali)日期的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                    <bdo id='GeRQk'></bdo><ul id='GeRQk'></ul>
                      <tbody id='GeRQk'></tbody>
                  • <i id='GeRQk'><tr id='GeRQk'><dt id='GeRQk'><q id='GeRQk'><span id='GeRQk'><b id='GeRQk'><form id='GeRQk'><ins id='GeRQk'></ins><ul id='GeRQk'></ul><sub id='GeRQk'></sub></form><legend id='GeRQk'></legend><bdo id='GeRQk'><pre id='GeRQk'><center id='GeRQk'></center></pre></bdo></b><th id='GeRQk'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GeRQk'><tfoot id='GeRQk'></tfoot><dl id='GeRQk'><fieldset id='GeRQk'></fieldset></dl></div>
                  • <tfoot id='GeRQk'></tfoot>

                        • <small id='GeRQk'></small><noframes id='GeRQk'>

                            <legend id='GeRQk'><style id='GeRQk'><dir id='GeRQk'><q id='GeRQk'></q></dir></style></legend>
                            主站蜘蛛池模板: 精品一区欧美 | 午夜电影一区 | 亚洲日日夜夜 | 国产在线1区 | 精品国产一区二区三区四区在线 | 亚洲高清在线播放 | 欧美在线成人影院 | 亚洲欧美在线观看 | 日韩av在线中文字幕 | 一级免费毛片 | 国产一区二区三区在线观看免费 | 精品久久久久香蕉网 | www久久久 | 国产精品观看 | 国产精品视频在线播放 | 四虎网站在线观看 | 国产成人一区二区三区电影 | 欧美日韩综合 | 日本欧美视频 | 99精品国产一区二区三区 | 福利成人 | 国产99久久精品一区二区永久免费 | 成人精品一区亚洲午夜久久久 | 国产精品极品美女在线观看免费 | 久久精品亚洲精品国产欧美 | 国产在线视频一区 | 亚洲精品乱码 | 欧美视频第三页 | 亚洲国产精品一区二区三区 | 免费国产一区二区视频 | 久久99精品久久久久婷婷 | 午夜影视在线观看 | 午夜视频大全 | 99re6在线视频精品免费 | 亚洲一区视频在线 | 国产日韩一区二区三区 | 日韩综合在线播放 | 国产成人精品一区二区三区在线观看 | 黄片毛片免费观看 | 国产精品亚洲精品 | 成人午夜精品一区二区三区 |